mirror of https://github.com/k3s-io/k3s
Merge pull request #60683 from nilebox/pod-template-validation-fix
Automatic merge from submit-queue (batch tested with PRs 60683, 60386). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix PodTemplate validation **What this PR does / why we need it**: This is a bugfix for pod template validation, which can be reproduced by deleting with "foreground deletion" mode (`DeleteOptions.PropagationPolicy = metav1.DeletePropagationForeground`). Because of this bug GC will never delete a pod template with `foregroundDeletion` finalizer. **Special notes for your reviewer**: The issue was originally found and confirmed in the PR #59851, where switching to foreground deletion in `kubectl` broke a unit test revealing this bug. Extracted for easier backporting to releases as suggested in https://github.com/kubernetes/kubernetes/pull/59851#discussion_r171576397 /cc @liggitt @caesarxuchao /sig api-machinery ```release-note NONE ```pull/6/head
commit
164890bab7
|
@ -3503,7 +3503,7 @@ func ValidatePodTemplate(pod *core.PodTemplate) field.ErrorList {
|
|||
// ValidatePodTemplateUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields
|
||||
// that cannot be changed.
|
||||
func ValidatePodTemplateUpdate(newPod, oldPod *core.PodTemplate) field.ErrorList {
|
||||
allErrs := ValidateObjectMetaUpdate(&oldPod.ObjectMeta, &newPod.ObjectMeta, field.NewPath("metadata"))
|
||||
allErrs := ValidateObjectMetaUpdate(&newPod.ObjectMeta, &oldPod.ObjectMeta, field.NewPath("metadata"))
|
||||
allErrs = append(allErrs, ValidatePodTemplateSpec(&newPod.Template, field.NewPath("template"))...)
|
||||
return allErrs
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue