Closed rkosyk closed 1 month ago
Closing this issue because I have found an explanation for this - If you specify a CPU limit for a Container but do not specify a CPU request, Kubernetes automatically assigns a CPU request that matches the limit.
https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/#if-you-specify-a-cpu-limit-but-do-not-specify-a-cpu-request
It looks like K8sRequiredResources ConstraintTemplate doesn't work properly
For example this constraint: https://github.com/open-policy-agent/gatekeeper-library/blob/master/library/general/containerresources/samples/container-must-have-limits-and-requests/constraint.yaml
allows the creation of pod without container resources
requests
defined, as shown in this example:It is expected that the creation of such a pod should be disallowed.