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
kubelet: add initial support for cgroupv2 #85218
Conversation
Hi @giuseppe. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
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.
/uncc
Looking forward to reading the KEP :) Removing myself as a reviewer while this diff is WIP.
/ok-to-test |
KEP here: kubernetes/enhancements#1370 |
WIP backport of: kubernetes/kubernetes#85218 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
/assign |
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 want to review this a little closer.
no conversion was needed for pids and hugepages, correct?
Cgroups: cgroups, | ||
Paths: paths, | ||
}, nil | ||
f, err := cgroupsystemd.NewSystemdCgroupsManager() |
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.
does this manager work on v1 and v2 hosts?
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 need to check the runc code, but is this abstracing legacy from unified manager?
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.
yes, NewSystemdCgroupsManager()
checks for the cgroup version used:
If we are running on cgroup v1, it will use cgroupsystemd.LegacyManager
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.
thanks for pointer, and noting that i confirmed this is in the vendored version.
yes correct, both pids and hugetlb don't need any conversion. I'll need to add support for hugetlb to cAdvisor though, once Linux 5.6 is out (it is still at 5.6-rc5), support in libcontainer is already being added. |
/uncc Whoops, I didn't get to this before @derekwaynecarr did. Tbh, I don't see myself adding anything that his review wouldn't, so going to defer to him on the review :) |
if libcontainercgroups.IsCgroup2UnifiedMode() { | ||
if resourceConfig.CpuShares != nil { | ||
// Convert from the range [2-262144] to [1-10000] | ||
resources.CpuWeight = (1 + ((*resourceConfig.CpuShares-2)*9999)/262142) |
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.
minor nit: may be useful to move this conversion into a helper that we can then unit test in a follow-on.
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.
PR here: #89567
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.
great to see this progress.
/approve
/lgtm
/milestone v1.19 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: derekwaynecarr, giuseppe 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 |
Wow, exciting stuff @giuseppe @derekwaynecarr - big thank you for all your work! |
follow-up for kubernetes#85218 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
/kind feature
do a conversion from the cgroups v1 limits to cgroups v2.
e.g. cpu.shares on cgroups v1 has a range of [2-262144] while the
equivalent on cgroups v2 is cpu.weight that uses a range [1-10000].
Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com
Does this PR introduce a user-facing change?:
NONE
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: