Let the initializer admission plugin set the metadata.intializers to nil

if an update makes the pendings and the result both nil
This commit is contained in:
Chao Xu
2017-08-21 23:10:17 -07:00
parent f2993b810c
commit fcd646d80e
3 changed files with 26 additions and 3 deletions

View File

@@ -208,6 +208,9 @@ func (i *initializer) Admit(a admission.Attributes) (err error) {
glog.V(5).Infof("Modifying uninitialized resource %s", a.GetResource())
if updated != nil && len(updated.Pending) == 0 && updated.Result == nil {
accessor.SetInitializers(nil)
}
// because we are called before validation, we need to ensure the update transition is valid.
if errs := validation.ValidateInitializersUpdate(updated, existing, initializerFieldPath); len(errs) > 0 {
return errors.NewInvalid(a.GetKind().GroupKind(), a.GetName(), errs)