-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Request the pid of another container if current pid is not longer valid #3301
Conversation
Hi @harche. 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 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. |
/lgtm |
container/crio/handler.go
Outdated
if len(stats.Network.Interfaces) == 0 { | ||
// No network related information indicates that the pid of the | ||
// container is not longer valid and we need to ask crio to | ||
// provide the pid of another container from that pod | ||
h.pidKnown = false | ||
return stats, nil | ||
} |
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 think we should double check h.needNet()
here, or else we may needlessly recall into cri-o because a container didn't provide the network stats
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.
we can just combine this check as else if len(...)
below
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.
@haircommander Thanks, good point. Updated.
container/crio/handler.go
Outdated
if h.needNet() && len(stats.Network.Interfaces) == 0 { | ||
// No network related information indicates that the pid of the | ||
// container is not longer valid and we need to ask crio to | ||
// provide the pid of another container from that pod | ||
h.pidKnown = false | ||
return stats, nil |
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 would prefer these two conditions are switched so we don't have to call needsNet twice:
if !h.needNet() {
....
} else if len(...) {
....
}
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.
@haircommander Done. Thanks.
Signed-off-by: Harshal Patil <harpatil@redhat.com> Co-authored-by: Ryan Phillips <rphillips@redhat.com>
/lgtm thanks! |
/assign @bobbypage @dims |
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
/ok-to-test |
/approve |
lgtm, thanks! |
When using CRI-O as the container runtime, the infrastructure container can be dropped. In this scenario, CRI-O provides cadvisor with the process ID (PID) of one of the containers within the pod to collect network statistics. However, if the particular container exits, cadvisor is left with an invalid PID. To address this issue, this PR makes cadvisor to switch to another PID from the same pod, ensuring the continuous collection of network statistics.
Pod used to validate this change,