added validation check to block adding an ephemeral container to a static pod and test cases
This commit is contained in:
@@ -4688,6 +4688,11 @@ func ValidatePodEphemeralContainersUpdate(newPod, oldPod *core.Pod, opts PodVali
|
||||
allErrs = append(allErrs, validatePodMetadataAndSpec(newPod, opts)...)
|
||||
allErrs = append(allErrs, ValidatePodSpecificAnnotationUpdates(newPod, oldPod, fldPath.Child("annotations"), opts)...)
|
||||
|
||||
// static pods don't support ephemeral containers #113935
|
||||
if _, ok := oldPod.Annotations[core.MirrorPodAnnotationKey]; ok {
|
||||
return field.ErrorList{field.Forbidden(field.NewPath(""), "static pods do not support ephemeral containers")}
|
||||
}
|
||||
|
||||
// Part 2: Validate that the changes between oldPod.Spec.EphemeralContainers and
|
||||
// newPod.Spec.EphemeralContainers are allowed.
|
||||
//
|
||||
|
Reference in New Issue
Block a user