fail admission check upon nil/empty overhead map

Signed-off-by: Min Jin <minkimzz@amazon.com>
This commit is contained in:
Min Jin 2024-02-04 21:53:38 -08:00
parent 3a4c35cc89
commit fdd1f3766b
No known key found for this signature in database
GPG Key ID: C72261E2E66E34A8

View File

@ -175,7 +175,7 @@ func setOverhead(a admission.Attributes, pod *api.Pod, runtimeClass *nodev1.Runt
}
// reject pod if Overhead is already set that differs from what is defined in RuntimeClass
if pod.Spec.Overhead != nil && !apiequality.Semantic.DeepEqual(nodeOverhead.PodFixed, pod.Spec.Overhead) {
if len(pod.Spec.Overhead) > 0 && !apiequality.Semantic.DeepEqual(nodeOverhead.PodFixed, pod.Spec.Overhead) {
return admission.NewForbidden(a, fmt.Errorf("pod rejected: Pod's Overhead doesn't match RuntimeClass's defined Overhead"))
}