Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crio: filter out systemd related components #2957

Merged
merged 1 commit into from
Nov 9, 2021

Conversation

rphillips
Copy link
Contributor

In Openshift we are seeing systemd components get added to housekeeping within the Kubelet using crio. This patch filters the system-systemd namespace for containers.

cc @harche

@google-cla google-cla bot added the cla: yes label Oct 11, 2021
@k8s-ci-robot
Copy link
Collaborator

Hi @rphillips. Thanks for your PR.

I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@bobbypage
Copy link
Collaborator

/ok-to-test

@harche
Copy link
Contributor

harche commented Oct 12, 2021

@rphillips Thanks for this PR. I presume this PR is trying to fix the cadvisor related issue reported in https://bugzilla.redhat.com/show_bug.cgi?id=1978528

This fix looks good, but not sure if I got it entirely correctly or I am missing something. This fix seem to add an awareness in the crio factory that it cannot handle and accept paths with system-systemd. But in the logs of that bug the error seems to be coming from the raw factory and not crio factory.

If you look at the way suitable factory is selected, it just iterates over all existing implementations of that interface. So would it be possible that even after having this fix in place, which would make crio factory return with false for canHandle but then raw factory to still handle it and error out anyway?

Since the code path going all the way into raw factory, which seem to be handling just about anything, I am slightly concerned that the problem might persist or I didn't get that flow correctly.

If possible, it would be great to have a unit test in container/factory_test.go to verify that this fix indeed addresses the reported issue.

/hold

@rphillips
Copy link
Contributor Author

Good point. It does look like the raw handler allows just about anything. Going to close this PR.

@rphillips rphillips closed this Oct 12, 2021
@rphillips rphillips reopened this Oct 12, 2021
Do not allow registration of systemd related services.
@@ -32,6 +32,9 @@ import (
// The namespace under which crio aliases are unique.
const CrioNamespace = "crio"

// The namespace systemd runs components under.
const SystemdNamespace = "system-systemd"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this public?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping, no need for this to be public right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is not a need, but I kept the precedent from the CrioNamespace variable.

@harche
Copy link
Contributor

harche commented Oct 20, 2021

@bobbypage While this updated PR can potentially fix the issue by returning true for canHandle but false for canAccept, as I mentioned in #2957 (comment), the way appropriate factory is selected right now is by iterating over the keys of a hasmap. This would not guarantee the order in which the factories are evaluated to see if they can handle (and can accept) the given path.

Considering the raw factory can handle pretty much anything, IMO we should make sure that it's always considered last before other factories. To be precise, we need to iterate over an ordered list (where raw is last) instead of the current hasmap here, https://github.com/google/cadvisor/blob/master/container/factory.go#L235

Let me know what do you think about this, if you are fine by it I can send a PR to fix that and then we can consider accepting this PR.

@harche
Copy link
Contributor

harche commented Oct 28, 2021

#2999

@bobbypage
Copy link
Collaborator

#2999 is merged. Is there anything needed to update in this PR or is it ready to review/merge?

I would like to cut release on cAdvisor soon so we can vendor it back into k/k in time for k8s1.23 code freeze.

@rphillips
Copy link
Contributor Author

This is ready for review and merge.

@bobbypage
Copy link
Collaborator

thanks, small nit on #2957 (comment) and this is ready to go

@rphillips
Copy link
Contributor Author

Commented here #2957 (comment) ... I think we should preserve the precedent.

@bobbypage
Copy link
Collaborator

LGTM

@bobbypage bobbypage merged commit 79b4c64 into google:master Nov 9, 2021
swghosh pushed a commit to swghosh/cadvisor that referenced this pull request Nov 11, 2021
sjenning added a commit to openshift/google-cadvisor that referenced this pull request Nov 11, 2021
UPSTREAM: google/cadvisor: google#2957, google#2999; crio filter out systemd events, always evaluate raw factory last
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants