-
Notifications
You must be signed in to change notification settings - Fork 39k
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
Filter out duplicated container stats #54606
Filter out duplicated container stats #54606
Conversation
@miaoyq: Adding do-not-merge/release-note-label-needed because the release note process has not been followed. One of the following labels is required "release-note", "release-note-action-required", or "release-note-none". 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. |
9f1fcca
to
365c2e7
Compare
/release-note-none |
based on #53514 (comment), we only want to exclude terminated containers if they are duplicated. I.E. if we have stats for another container in that pod with the same name. |
@dashpole Got it. Thank you for reminding me. : ) |
1e210f6
to
d4125b5
Compare
@dashpole I have updated the code and add unit test for this, PTAL, Thanks. :) |
} | ||
i := 0 | ||
for ; i < len(refs); i++ { | ||
if containerStatsMap[refs[i].Id].Cpu != nil || containerStatsMap[refs[i].Id].Memory != 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.
Is it ever possible to have more than one container in refs running at once? Why cant we just take the last element from the list?
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.
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.
ping @yguo0905
Could you please help us solve our doubts, thanks so much. :-)
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 would allow us to detect the error case where multiple containers with the same name are active at the same time. See #47853 (comment).
/assign @Random-Liu |
Let's wait for the answer to #53514 (comment). If we'd like to do the filtering for cadvisor and cri stats, is it possible to have a single |
Thanks @yguo0905 , I find it's hard to have a single removeTerminatedContainer works for both cases, because the objects filtered are different about |
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 other than the comments.
}) | ||
for _, container := range containers { | ||
// Filter out the container that isn't managed by a Pod | ||
if container.PodSandboxId == "" { |
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 can assume that all container stats returned by CRI container runtime are for kubelet. If not, it is an error.
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.
Do we delete this logic? or return an error here?
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 delete the logic is fine. :)
continue | ||
} | ||
i := 0 | ||
for ; i < len(refs); i++ { |
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 prefer check container state and only keep running containers, since we've already got container state.
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.
Done.
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 seems that this is not addressed.
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 have not got what you mean clearly, done.
23c193a
to
1b9b2f2
Compare
/test pull-kubernetes-node-e2e |
result = append(result, refs[0]) | ||
continue | ||
} | ||
for i := 0; i < len(refs); i++ { |
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.
Can we add one more logic? If no running container found, we should add the latest container.
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.
Sorry for this, have added, PTAL, :-)
LGTM with one last nit. |
/priority important-soon |
[MILESTONENOTIFIER] Milestone Pull Request Needs Approval @Random-Liu @dashpole @miaoyq @tmrts @kubernetes/sig-node-misc Action required: This pull request must have the Pull Request Labels
|
1b9b2f2
to
11cf390
Compare
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: miaoyq, Random-Liu Associated issue: 53514 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@miaoyq Thanks for working on this! |
/retest |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Which issue this PR fixes *
fixes #53514
Special notes for your reviewer:
/cc @Random-Liu
Signed-off-by: Yanqiang Miao miao.yanqiang@zte.com.cn