Playlist: Fix mutation logic (#95925)

This commit is contained in:
Todd Treece 2024-11-05 21:00:10 -05:00 committed by GitHub
parent 280c27507c
commit ed52515ae3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,13 +30,9 @@ func (b *appBuilder) Mutate(ctx context.Context, a admission.Attributes, o admis
}
obj := a.GetObject()
if obj == nil {
return errors.New("object is nil")
if obj != nil && resp.UpdatedObject != nil {
reflect.ValueOf(obj).Elem().Set(reflect.ValueOf(resp.UpdatedObject).Elem())
}
if resp.UpdatedObject == nil {
return errors.New("updated object is nil")
}
reflect.ValueOf(obj).Elem().Set(reflect.ValueOf(resp.UpdatedObject).Elem())
return nil
}