mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #41621 from derekwaynecarr/best-effort-qos-shares
Automatic merge from submit-queue BestEffort QoS class has min cpu shares **What this PR does / why we need it**: BestEffort QoS class is given the minimum amount of CPU shares per the QoS design.
This commit is contained in:
commit
28a8d783e6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user