diff --git a/pkg/kubelet/cm/container_manager_linux.go b/pkg/kubelet/cm/container_manager_linux.go index 71b55c2e84e..c0b1bdd073b 100644 --- a/pkg/kubelet/cm/container_manager_linux.go +++ b/pkg/kubelet/cm/container_manager_linux.go @@ -283,16 +283,28 @@ func InitQOS(cgroupDriver, rootContainer string, subsystems *CgroupSubsystems) ( for _, qosClass := range qosClasses { // get the container's absolute name absoluteContainerName := CgroupName(path.Join(rootContainer, string(qosClass))) + + resourceParameters := &ResourceConfig{} + // the BestEffort QoS class has a statically configured minShares value + if qosClass == v1.PodQOSBestEffort { + minShares := int64(MinShares) + resourceParameters.CpuShares = &minShares + } // containerConfig object stores the cgroup specifications containerConfig := &CgroupConfig{ Name: absoluteContainerName, - ResourceParameters: &ResourceConfig{}, + ResourceParameters: resourceParameters, } // check if it exists if !cm.Exists(absoluteContainerName) { if err := cm.Create(containerConfig); err != nil { return QOSContainersInfo{}, fmt.Errorf("failed to create top level %v QOS cgroup : %v", qosClass, err) } + } else { + // to ensure we actually have the right state, we update the config on startup + if err := cm.Update(containerConfig); err != nil { + return QOSContainersInfo{}, fmt.Errorf("failed to update top level %v QOS cgroup : %v", qosClass, err) + } } } // Store the top level qos container names