mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
Inline patch#toUnversioned
This commit is contained in:
parent
3332a0c972
commit
870d121d5e
@ -242,11 +242,6 @@ type patcher struct {
|
|||||||
mechanism patchMechanism
|
mechanism patchMechanism
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *patcher) toUnversioned(versionedObj runtime.Object) (runtime.Object, error) {
|
|
||||||
gvk := p.kind.GroupKind().WithVersion(runtime.APIVersionInternal)
|
|
||||||
return p.unsafeConvertor.ConvertToVersion(versionedObj, gvk.GroupVersion())
|
|
||||||
}
|
|
||||||
|
|
||||||
type patchMechanism interface {
|
type patchMechanism interface {
|
||||||
applyPatchToCurrentObject(currentObject runtime.Object) (runtime.Object, error)
|
applyPatchToCurrentObject(currentObject runtime.Object) (runtime.Object, error)
|
||||||
}
|
}
|
||||||
@ -321,12 +316,8 @@ func (p *smpPatcher) applyPatchToCurrentObject(currentObject runtime.Object) (ru
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Convert the object back to unversioned (aka internal version).
|
// Convert the object back to unversioned (aka internal version).
|
||||||
unversionedObjToUpdate, err := p.toUnversioned(versionedObjToUpdate)
|
gvk := p.kind.GroupKind().WithVersion(runtime.APIVersionInternal)
|
||||||
if err != nil {
|
return p.unsafeConvertor.ConvertToVersion(versionedObjToUpdate, gvk.GroupVersion())
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return unversionedObjToUpdate, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// strategicPatchObject applies a strategic merge patch of <patchJS> to
|
// strategicPatchObject applies a strategic merge patch of <patchJS> to
|
||||||
|
Loading…
Reference in New Issue
Block a user