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
Add "only_cpu_and_memory" GET parameter to /stats/summary http handler in kubele #67829
Conversation
@mwielgus this does not fall under sig node? |
^ i have the same question. ;-) @krzysztof-jastrzebski please add a release note explaining your change. |
795d135
to
c17df7a
Compare
c17df7a
to
5fba230
Compare
5fba230
to
5d24448
Compare
@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. |
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. |
/ok-to-test |
/test pull-kubernetes-e2e-kops-aws |
I think this makes sense as a temporary solution. We can hopefully start discussions on the core metrics API for the 1.13 timeframe |
Is there anything I need to fix? |
/lgtm |
5d24448
to
26f7693
Compare
pkg/kubelet/server/stats/summary.go
Outdated
@@ -81,6 +81,31 @@ func (sp *summaryProviderImpl) Get(updateStats bool) (*statsapi.Summary, error) | |||
Rlimit: rlimit, | |||
SystemContainers: sp.GetSystemContainersStats(nodeConfig, podStats, updateStats), | |||
} | |||
|
|||
if onlyCPUAndMemory { |
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.
Could you create a new function instead? I think it'd be easier to test and maintain down the road.
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.
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.
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
26f7693
to
c2f6ca5
Compare
/test pull-kubernetes-e2e-gce-100-performance |
c2f6ca5
to
b9ad1ad
Compare
b9ad1ad
to
2b94c17
Compare
…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.
2b94c17
to
138a3c7
Compare
/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) |
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.
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...
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 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?
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 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 :-)
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.
As we are close to release, please continue this work in 1.13! |
/approve |
/lgtm based on #67829 (comment) |
[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 |
/test pull-kubernetes-e2e-gce-100-performance |
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: