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

Merged
merged 1 commit into from Feb 27, 2018

Conversation

@Random-Liu
Member

Random-Liu commented Feb 23, 2018

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:

Summary API will include pod CPU and Memory stats for CRI container runtime.
@Random-Liu

This comment has been minimized.

Member

Random-Liu commented Feb 23, 2018

/retest

1 similar comment
@Random-Liu

This comment has been minimized.

Member

Random-Liu commented Feb 23, 2018

/retest

podUID types.UID,
allInfos map[string]cadvisorapiv2.ContainerInfo,
) {
podCgroupInfo := getcadvisorPodInfoFromPodUID(podUID, allInfos)

This comment has been minimized.

@yguo0905

yguo0905 Feb 24, 2018

Contributor

Not for changes made in this PR but this should be "getCadvisorPodInfoFromPodUID"

This comment has been minimized.

@Random-Liu
cpu, memory := cadvisorInfoToCPUandMemoryStats(podCgroupInfo)
ps.CPU = cpu
ps.Memory = memory
}

This comment has been minimized.

@yguo0905

yguo0905 Feb 24, 2018

Contributor

Do we need to log something if it's not found?

This comment has been minimized.

@Random-Liu

Random-Liu Feb 26, 2018

Member

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

This comment has been minimized.

@yguo0905

yguo0905 Feb 24, 2018

Contributor

For my education - what does this comment mean?

This comment has been minimized.

@Random-Liu

Random-Liu Feb 26, 2018

Member

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.

@yguo0905

This comment has been minimized.

Contributor

yguo0905 commented Feb 24, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Feb 24, 2018

@yguo0905

This comment has been minimized.

Contributor

yguo0905 commented Feb 24, 2018

/hold
for the comments

@abhi

abhi approved these changes Feb 26, 2018

Just had one q: why the CPU stats is calculated against all pods (termininated and running)
otherwise LGTM

@Random-Liu

This comment has been minimized.

Member

Random-Liu commented Feb 26, 2018

why the CPU stats is calculated against all pods (termininated and running)

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.

Add CPU/Memory pod stats for CRI stats.
Signed-off-by: Lantao Liu <lantaol@google.com>

@k8s-merge-robot k8s-merge-robot removed the lgtm label Feb 26, 2018

@yguo0905

This comment has been minimized.

Contributor

yguo0905 commented Feb 26, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Feb 26, 2018

@k8s-ci-robot

This comment has been minimized.

Contributor

k8s-ci-robot commented Feb 26, 2018

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Random-Liu

This comment has been minimized.

Member

Random-Liu commented Feb 26, 2018

Remove hold

@Random-Liu

This comment has been minimized.

Member

Random-Liu commented Feb 27, 2018

/retest

@k8s-merge-robot

This comment has been minimized.

Contributor

k8s-merge-robot commented Feb 27, 2018

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.

@k8s-merge-robot k8s-merge-robot merged commit 3039a77 into kubernetes:master Feb 27, 2018

13 checks passed

Submit Queue Queued to run github e2e tests a second time.
Details
cla/linuxfoundation Random-Liu authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-cross Skipped
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gke Skipped
pull-kubernetes-e2e-kops-aws Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce Job succeeded.
Details
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-unit Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details

@Random-Liu Random-Liu deleted the Random-Liu:fix-pod-stats branch Feb 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment