Skip to content
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 "only_cpu_and_memory" GET parameter to /stats/summary http handler in kubele #67829

Merged
merged 1 commit into from Sep 26, 2018

Conversation

krzysztof-jastrzebski
Copy link
Contributor

@krzysztof-jastrzebski krzysztof-jastrzebski commented Aug 24, 2018

What this PR does / why we need it:
PR adds "only_cpu_and_memory" GET parameter to /stats/summary http handler in kubelet. If parameter is true then only cpu and memory will be present in response. The parameter will be used by Metric Server to avoid sending/decoding unneeded data. Metric server needs only cpu and memory.

Release note:

Add "only_cpu_and_memory" GET parameter to /stats/summary http handler in kubelet. If parameter is true then only cpu and memory will be present in response.

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 24, 2018
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. labels Aug 24, 2018
@mwielgus mwielgus removed the sig/node Categorizes an issue or PR as relevant to SIG Node. label Aug 24, 2018
@dims
Copy link
Member

dims commented Aug 24, 2018

@mwielgus this does not fall under sig node?

@neolit123
Copy link
Member

neolit123 commented Aug 25, 2018

^ i have the same question. ;-)

@krzysztof-jastrzebski please add a release note explaining your change.
https://github.com/kubernetes/kubernetes/blob/master/.github/PULL_REQUEST_TEMPLATE.md

@k8s-ci-robot k8s-ci-robot added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Aug 27, 2018
@krzysztof-jastrzebski krzysztof-jastrzebski changed the title Add /stats/cpuandmemory http handller to kubelet. Add "only_cpu_and_memory" GET parameter to /stats/summary http handler in kubele Aug 27, 2018
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 27, 2018
@dashpole
Copy link
Contributor

@krzysztof-jastrzebski This seems to be a way to implement core metrics in the kubelet. Back when I proposed the set of core metrics, sig-instrumentation wasn't ready to consume scoped-down metrics in heapster (which has now become the metrics server), and thus we punted on adding the new endpoint. IMO, if the metrics-server is in a position to consume core metrics, we should define the core metrics endpoint, rather than making this change. That way we can also begin the process of removing dependencies on the summary api.

@mwielgus mwielgus added this to the v1.12 milestone Aug 28, 2018
@krzysztof-jastrzebski
Copy link
Contributor Author

Using new endpoint requires migrating all nodes in the cluster to the version with new endpoint. As we support 3 versions it can't be delivered before version 1.15. This could be a temporary solution before final solution is delivered.

@dashpole
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 29, 2018
@krzysztof-jastrzebski
Copy link
Contributor Author

/test pull-kubernetes-e2e-kops-aws

@dashpole
Copy link
Contributor

I think this makes sense as a temporary solution. We can hopefully start discussions on the core metrics API for the 1.13 timeframe

@krzysztof-jastrzebski
Copy link
Contributor Author

Is there anything I need to fix?

@dashpole
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 31, 2018
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 5, 2018
@@ -81,6 +81,31 @@ func (sp *summaryProviderImpl) Get(updateStats bool) (*statsapi.Summary, error)
Rlimit: rlimit,
SystemContainers: sp.GetSystemContainersStats(nodeConfig, podStats, updateStats),
}

if onlyCPUAndMemory {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a new function instead? I think it'd be easier to test and maintain down the road.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh...sorry for not being clear. I was thinking that we could add a GetCPUMemoryStats function, as opposed to adding another flag in the Get function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@krzysztof-jastrzebski
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-100-performance
/test pull-kubernetes-e2e-kops-aws

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 6, 2018
…r in kubelet. If parameter is true then only cpu and memory will be present in response. The parameter will be used by Metric Server to avoid sending/decoding unneeded data.
@krzysztof-jastrzebski
Copy link
Contributor Author

/test pull-kubernetes-e2e-kops-aws

@@ -87,3 +89,32 @@ func (sp *summaryProviderImpl) Get(updateStats bool) (*statsapi.Summary, error)
}
return &summary, nil
}

func (sp *summaryProviderImpl) GetCPUAndMemoryStats() (*statsapi.Summary, error) {
summary, err := sp.Get(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be hard to actually bypass getting the imageFS (and other unused) stats? Setting them to nil after getting all the data seems sub-optimal...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to bypass getting all unneeded stats or only some of them? Do you want me to add functions to StatsProvider that returns only needed stats?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to bypass getting all unneeded stats or only some of them?

Bypassing all unneeded if possible.

Do you want me to add functions to StatsProvider that returns only needed stats?

If that's needed, then yes :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have final #68841 but it is much bigger than this one.
Could we submit this PR and later submit final version? I would like to push this PR to 1.12 patch release and #68841 will be released with 1.13. It will be easier to release smaller PR in patch release.

@guineveresaenger
Copy link
Contributor

As we are close to release, please continue this work in 1.13!
/milestone v1.13

@k8s-ci-robot k8s-ci-robot modified the milestones: v1.12, v1.13 Sep 18, 2018
@yujuhong
Copy link
Contributor

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2018
@yujuhong
Copy link
Contributor

/lgtm

based on #67829 (comment)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 26, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dashpole, krzysztof-jastrzebski, yujuhong

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

@krzysztof-jastrzebski
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-100-performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants