mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
let objects without metadata pass through the managedFields admission controller
Not all objects provide metadata. There might be extention servers that allow for creating objects without the metadata field. This PR changes the managedFileds admission to deal with objects without the metadata field. Object without that field will be passed directly to the wrapped admission controller for further validation.
This commit is contained in:
parent
6e29545168
commit
3dbaf305ae
@ -60,7 +60,10 @@ func (admit *managedFieldsValidatingAdmissionController) Admit(ctx context.Conte
|
||||
}
|
||||
objectMeta, err := meta.Accessor(a.GetObject())
|
||||
if err != nil {
|
||||
return err
|
||||
// the object we are dealing with doesn't have object metadata defined
|
||||
// in that case we don't have to keep track of the managedField
|
||||
// just call the wrapped admission
|
||||
return mutationInterface.Admit(ctx, a, o)
|
||||
}
|
||||
managedFieldsBeforeAdmission := objectMeta.GetManagedFields()
|
||||
if err := mutationInterface.Admit(ctx, a, o); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user