@@ -5657,23 +5657,23 @@ func ValidatePodResize(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel
5657
5657
dropCPUMemoryResourcesFromContainer (& container , & oldPod .Spec .InitContainers [ix ])
5658
5658
if ! apiequality .Semantic .DeepEqual (container , oldPod .Spec .InitContainers [ix ]) {
5659
5659
// This likely means that the user has made changes to resources other than CPU and memory for sidecar container.
5660
- specDiff := cmp .Diff (oldPod .Spec .InitContainers [ix ], container )
5661
- errs := field .Forbidden (specPath , fmt .Sprintf ("only cpu and memory resources for sidecar containers are mutable\n %v" , specDiff ))
5660
+ errs := field .Forbidden (specPath , "only cpu and memory resources for sidecar containers are mutable" )
5662
5661
allErrs = append (allErrs , errs )
5663
- return allErrs
5664
5662
}
5665
5663
} else if ! apiequality .Semantic .DeepEqual (container , oldPod .Spec .InitContainers [ix ]) { // non-restartable init container
5666
5664
// This likely means that the user has modified resources of non-sidecar init container.
5667
- specDiff := cmp .Diff (oldPod .Spec .InitContainers [ix ], container )
5668
- errs := field .Forbidden (specPath , fmt .Sprintf ("resources for non-sidecar init containers are immutable\n %v" , specDiff ))
5665
+ errs := field .Forbidden (specPath , "resources for non-sidecar init containers are immutable" )
5669
5666
allErrs = append (allErrs , errs )
5670
- return allErrs
5671
5667
}
5672
5668
newInitContainers = append (newInitContainers , container )
5673
5669
}
5674
5670
originalCPUMemPodSpec .InitContainers = newInitContainers
5675
5671
}
5676
5672
5673
+ if len (allErrs ) > 0 {
5674
+ return allErrs
5675
+ }
5676
+
5677
5677
if ! apiequality .Semantic .DeepEqual (originalCPUMemPodSpec , oldPod .Spec ) {
5678
5678
// This likely means that the user has made changes to resources other than CPU and Memory.
5679
5679
specDiff := cmp .Diff (oldPod .Spec , originalCPUMemPodSpec )
0 commit comments