-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Add CPU/Memory pod stats for CRI stats. #60328
Conversation
41fcd9b
to
6db1fc8
Compare
/retest |
1 similar comment
/retest |
podUID types.UID, | ||
allInfos map[string]cadvisorapiv2.ContainerInfo, | ||
) { | ||
podCgroupInfo := getcadvisorPodInfoFromPodUID(podUID, allInfos) |
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.
Not for changes made in this PR but this should be "getCadvisorPodInfoFromPodUID"
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.
cpu, memory := cadvisorInfoToCPUandMemoryStats(podCgroupInfo) | ||
ps.CPU = cpu | ||
ps.Memory = memory | ||
} |
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 need to log something if it's not found?
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 don't do for cadvisor, so keep it the same.
See
podInfo := getcadvisorPodInfoFromPodUID(podUID, allInfos) |
@@ -145,12 +144,8 @@ func (p *criStatsProvider) ListPodStats() ([]statsapi.PodStats, error) { | |||
if !found { | |||
ps = buildPodStats(podSandbox) | |||
// Fill stats from cadvisor is available for full set of required pod 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.
For my education - what does this comment mean?
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.
CRI only provides part of cpu/memory stats summary api ,so we still need cadvisor stats to fill in the other fields in summary api.
/lgtm |
/hold |
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.
Just had one q: why the CPU stats is calculated against all pods (termininated and running)
otherwise LGTM
We generate pod stats only when dealing with container stats inside the pod, and we filtered out terminated container stats. This means that we'll only have pod stats for which has containers running. |
Signed-off-by: Lantao Liu <lantaol@google.com>
6db1fc8
to
3688650
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Random-Liu, yguo0905 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Remove hold |
/retest |
Automatic merge from submit-queue (batch tested with PRs 60011, 59256, 59293, 60328, 60367). If you want to cherry-pick this change to another branch, please follow the instructions here. |
For kubernetes/enhancements#286.
Add CPU and memory stats for pod.
@kubernetes/sig-node-pr-reviews
/cc @dashpole @yujuhong @abhi @yguo0905
Signed-off-by: Lantao Liu lantaol@google.com
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Release note: