-
Notifications
You must be signed in to change notification settings - Fork 745
Detect CRI pod sandbox containers #1297
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anoop-sysd
approved these changes
Jan 29, 2019
context.set_deadline(deadline); | ||
grpc::Status status = s_cri->PodSandboxStatus(&context, req, &resp); | ||
|
||
return status.ok(); |
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.
before returning, may be a DEBUG message logged if status is not ok would help in debugging.
anoop-sysd
approved these changes
Jan 29, 2019
Not having this on by default breaks installs where we actually have both Docker and containerd sockets (this happens on some Docker versions).
We cannot rely on CRI succeeding and in the worst case, we'll at least have the container ID.
Testing shows that we can fail to get the metadata early in the container's lifetime, so don't add an empty container in that case, just return a failure and we'll pick it up the next time around.
This allows container engines to return `false` but still set a container_id, which is useful for Docker and CRI (they may detect a container but fail to fetch its metadata, at least temporarily). In that case, we don't want to add a container object (so that a future lookup may succeed) but still record this process as a part of that container.
Pod sandbox containers _start_ with `k8s_POD`.
The cgroup may either be a container id or a pod id, but if it's neither, it's interesting enough to at least log a DEBUG message.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pause containers are reported in CRI as having container_id = pod_id (they do not exist as far as ContainerStatus is concerned).
If ContainerStatus fails for a container, try calling PodSandboxStatus. If that returns success, mark this container as a pod sandbox.