mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
kubelet: add initial support for cgroupv2
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>
This commit is contained in:
@@ -161,6 +161,10 @@ func validateSystemRequirements(mountUtil mount.Interface) (features, error) {
|
||||
return f, fmt.Errorf("%s - %v", localErr, err)
|
||||
}
|
||||
|
||||
if cgroups.IsCgroup2UnifiedMode() {
|
||||
return f, nil
|
||||
}
|
||||
|
||||
expectedCgroups := sets.NewString("cpu", "cpuacct", "cpuset", "memory")
|
||||
for _, mountPoint := range mountPoints {
|
||||
if mountPoint.Type == cgroupMountType {
|
||||
@@ -884,6 +888,11 @@ func getContainer(pid int) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if cgroups.IsCgroup2UnifiedMode() {
|
||||
c, _ := cgs[""]
|
||||
return c, nil
|
||||
}
|
||||
|
||||
cpu, found := cgs["cpu"]
|
||||
if !found {
|
||||
return "", cgroups.NewNotFoundError("cpu")
|
||||
|
||||
Reference in New Issue
Block a user