Skip to content

Commit b651178

Browse files
committed
fix incorrect configuration of kubepods.slice unit by kubelet (issue kubernetes#88197)
1 parent ea5cef1 commit b651178

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/kubelet/cm/node_container_manager_linux.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@ const (
3838

3939
//createNodeAllocatableCgroups creates Node Allocatable Cgroup when CgroupsPerQOS flag is specified as true
4040
func (cm *containerManagerImpl) createNodeAllocatableCgroups() error {
41+
nodeAllocatable := cm.internalCapacity
42+
// Use Node Allocatable limits instead of capacity if the user requested enforcing node allocatable.
43+
nc := cm.NodeConfig.NodeAllocatableConfig
44+
if cm.CgroupsPerQOS && nc.EnforceNodeAllocatable.Has(kubetypes.NodeAllocatableEnforcementKey) {
45+
nodeAllocatable = cm.getNodeAllocatableInternalAbsolute()
46+
}
47+
4148
cgroupConfig := &CgroupConfig{
4249
Name: cm.cgroupRoot,
4350
// The default limits for cpu shares can be very low which can lead to CPU starvation for pods.
44-
ResourceParameters: getCgroupConfig(cm.internalCapacity),
51+
ResourceParameters: getCgroupConfig(nodeAllocatable),
4552
}
4653
if cm.cgroupManager.Exists(cgroupConfig.Name) {
4754
return nil

0 commit comments

Comments
 (0)