Change:
I noticed ResourceConfigForPod isn't checking here: The methods called by ( and ) do check , but it looks like and can be true for burstable pods even when some of the initContainers do not declare cpu/memory limits. I'm not sure what the implications of setting these values are if an initContainer has no cpu or memory limit: /sig node /assign
After reading the code, I prefer that this is a bug according to . would you confirm? /assign I opened .
/triage accepted

Discussion:
} } <ins> for _, container := range pod.Spec.InitContainers { if container.Resources.Limits.Cpu().IsZero() { cpuLimitsDeclared = false } if container.Resources.Limits.Memory().IsZero() { memoryLimitsDeclared = false } containerHugePageLimits := HugePageLimits(container.Resources.Requests) for k, v := range containerHugePageLimits { if value, exists := hugePageLimits[k]; !exists || v > value { hugePageLimits[k] = v } } } </ins> // quota is not capped when cfs quota is disabled if !enforceCPULimits { cpuQuota = int64(-1)

quotaPeriod:      tunedQuotaPeriod, expected:         &ResourceConfig{CpuShares: &guaranteedShares, CpuQuota: &cpuNoLimit, CpuPeriod: &tunedQuotaPeriod, Memory: &guaranteedMemory}, }, <ins> "burstable-partial-limits-with-init-containers": { pod: &v1.Pod{ Spec: v1.PodSpec{ Containers: []v1.Container{ { Resources: getResourceRequirements(getResourceList("100m", "100m"), getResourceList("100m", "100Mi")), }, { Resources: getResourceRequirements(getResourceList("100m", "100m"), getResourceList("", "")), }, }, InitContainers: []v1.Container{ { Resources: getResourceRequirements(getResourceList("100m", "100m"), getResourceList("100m", "100Mi")), }, { Resources: getResourceRequirements(getResourceList("100m", "100m"), getResourceList("", "")), }, }, }, }, enforceCPULimits: true, quotaPeriod:      tunedQuotaPeriod, expected:         &ResourceConfig{CpuShares: &burstablePartialShares}, }, </ins> } for testName, testCase := range testCases {

actual := ResourceConfigForPod(testCase.pod, testCase.enforceCPULimits, testCase.quotaPeriod) if !reflect.DeepEqual(actual.CpuPeriod, testCase.expected.CpuPeriod) { <del> t.Errorf("unexpected result, test: %v, cpu period not as expected", testName) </del> <ins> t.Errorf("unexpected result, test: %v, cpu period not as expected. Expected: %v, Actual:%v", testName, *testCase.expected.CpuPeriod, *actual.CpuPeriod) </ins> } if !reflect.DeepEqual(actual.CpuQuota, testCase.expected.CpuQuota) { <del> t.Errorf("unexpected result, test: %v, cpu quota not as expected", testName) </del> <ins> t.Errorf("unexpected result, test: %v, cpu quota not as expected. Expected: %v, Actual:%v", testName, *testCase.expected.CpuQuota, *actual.CpuQuota) </ins> } if !reflect.DeepEqual(actual.CpuShares, testCase.expected.CpuShares) { <del> t.Errorf("unexpected result, test: %v, cpu shares not as expected", testName) </del> <ins> t.Errorf("unexpected result, test: %v, cpu shares not as expected. Expected: %v, Actual:%v", testName, *testCase.expected.CpuShares, &actual.CpuShares) </ins> } if !reflect.DeepEqual(actual.Memory, testCase.expected.Memory) { <del> t.Errorf("unexpected result, test: %v, memory not as expected", testName) </del> <ins> t.Errorf("unexpected result, test: %v, memory not as expected. Expected: %v, Actual:%v", testName, *testCase.expected.Memory, *actual.Memory) </ins> } } }