-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Make the containerd factory configurable #2203
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
Make the containerd factory configurable #2203
Conversation
|
Hi @0902horn. Thanks for your PR. I'm waiting for a google or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
|
This PR fixes #2082 . |
|
/ok-to-test cc @Random-Liu |
|
is it possible to get containers from all namespaces? Just curious |
According to comments of containerd namespaces package, I think getting containers across namespaces could confuse cAdvisor or other applications that rely on metrics provided by cAdvisor, since identifiers in different containerd namespaces might be the same and these namespaces are not reflected by metrics. |
|
@0902horn that makes sense. I was just curious if there was a way (e.g. empty string) to get everything if I wanted to. Since cAdvisor is a cgroup monitor, it will end up collecting metrics for those containers anyways. It just wouldn't attach metadata (e.g. container name) for those. I am fine with the change without that, but I wouldn't be surprised if we get a feature request for being able to do that eventually. |
|
@dashpole Thanks for your replies. I confirmed that this is by design by reading the doc. So a possible way is listing all namespaces and creating multiple clients with each to query containers. |
|
Thanks a bunch for the investigation. In that case, just supporting a single namespace seems like the correct behavior. I'll do a review in the next few days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
FYI @Random-Liu |
| ) | ||
|
|
||
| var ArgContainerdEndpoint = flag.String("containerd", "unix:///var/run/containerd.sock", "containerd endpoint") | ||
| var ArgContainerdEndpoint = flag.String("containerd", "/run/containerd/containerd.sock", "containerd endpoint") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, does this still work if it isn't a unix socket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has to be a unix socket because the original implementation of 'func Client' has following code (client.go#L58):
tryConn, err := net.DialTimeout("unix", address, connectionTimeout)
I think it is by design for security and simplicity. See this containerd issue containerd/containerd#1324.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to ask if this will still connect to the unix socket if you remove the unix:// prefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh...I thought you were asking TCP or something.
ArgContainerdEndpoint was not used before, so don't worry about changing its value's format. Now it is used and requires such format without unix:// prefix.
|
I'm happily seeing this PR is merged. Thanks @dashpole |
--containerdto '/run/containerd/containerd.sock'.--containerd-namespacedefaulting to 'k8s.io'.--containerdand--containerd-namespace.