Change:
generic.ObjectCountQuotaResourceNameFor(schema.GroupResource{Resource: "pods"}): resource.MustParse("1"), }, }, <ins> "count pod overhead as usage": { pod: &api.Pod{ Spec: api.PodSpec{ Overhead: api.ResourceList{ api.ResourceCPU: resource.MustParse("1"), }, Containers: []api.Container{ { Resources: api.ResourceRequirements{ Requests: api.ResourceList{ api.ResourceCPU: resource.MustParse("1"), }, Limits: api.ResourceList{ api.ResourceCPU: resource.MustParse("2"), }, }, }, }, }, }, usage: corev1.ResourceList{ corev1.ResourceRequestsCPU: resource.MustParse("2"), corev1.ResourceLimitsCPU:   resource.MustParse("3"), corev1.ResourcePods:        resource.MustParse("1"), corev1.ResourceCPU:         resource.MustParse("2"), generic.ObjectCountQuotaResourceNameFor(schema.GroupResource{Resource: "pods"}): resource.MustParse("1"), }, podOverheadEnabled: true, }, "do not count pod overhead as usage with pod overhead disabled": { pod: &api.Pod{ Spec: api.PodSpec{ Overhead: api.ResourceList{ api.ResourceCPU: resource.MustParse("1"), }, Containers: []api.Container{ { Resources: api.ResourceRequirements{ Requests: api.ResourceList{ api.ResourceCPU: resource.MustParse("1"), }, Limits: api.ResourceList{ api.ResourceCPU: resource.MustParse("2"), }, }, }, }, }, }, usage: corev1.ResourceList{ corev1.ResourceRequestsCPU: resource.MustParse("1"), corev1.ResourceLimitsCPU:   resource.MustParse("2"), corev1.ResourcePods:        resource.MustParse("1"), corev1.ResourceCPU:         resource.MustParse("1"), generic.ObjectCountQuotaResourceNameFor(schema.GroupResource{Resource: "pods"}): resource.MustParse("1"), }, podOverheadEnabled: false, }, </ins> } for testName, testCase := range testCases { t.Run(testName, func(t *testing.T) { <ins> defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.PodOverhead, testCase.podOverheadEnabled)() </ins> actual, err := evaluator.Usage(testCase.pod) if err != nil { t.Error(err)

Discussion:
assume that: cluster with only one node with 4G allocatable memory Define test runtimeclass with PodOverhead Define resourceQuota test under test namespace with 4Gi memory limit Create Pod with test runtimeClass under test namespace podOverhead resource not counted into resourceQuota used info podOverhead resource counted into node requests info try to create one more pod with 2G memory requests, resourceQuota check passed but failed to schedule because it requests 2G+200M memory podOverhead resource should be counted into resourceQuota used info to keep resourceQuota check and schedule check be consistent. Kubernetes version 1.16
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/assign
/sig node
ref:
-- can you verify that you have the feature gate enabled for pod overhead for api-server, as well as kubelet and scheduler? Example:
I made a cluster with the following command, using crio as a container runtime( is not available with Docker) And the issue was reproduced.
overhead feature enabled, the overhead resource has been counted into requests during scheduling but not counted into resourcequota
Currently, PodOverhead is defined as a fixed resource. this value looks like the average usage value and being into requests resource during scheduling. type Overhead struct { PodFixed *ResourceList } My use case is kata_container, the VMM related processes consume much overhead resource when pod running with high workload. A small overhead(small cgroup limits) will trigger oom but a big value result that big overhead requests take into account during scheduling. So how about define PodOverhead including limits and requests like that in Pod resources definition. It could be helpful resources: limits: memory: 1Gi requests: memory: 200M
CC: FYI