|
|
@ -409,19 +409,13 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P
|
|
|
|
// returned from ConvertToVersion. Anything that's unstructured should
|
|
|
|
// returned from ConvertToVersion. Anything that's unstructured should
|
|
|
|
// use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported
|
|
|
|
// use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported
|
|
|
|
// on objects like CRDs.
|
|
|
|
// on objects like CRDs.
|
|
|
|
_, isUnstructured := versionedObject.(runtime.Unstructured)
|
|
|
|
if _, ok := versionedObject.(runtime.Unstructured); ok {
|
|
|
|
|
|
|
|
|
|
|
|
switch {
|
|
|
|
|
|
|
|
case runtime.IsNotRegisteredError(err), isUnstructured:
|
|
|
|
|
|
|
|
// fall back to generic JSON merge patch
|
|
|
|
// fall back to generic JSON merge patch
|
|
|
|
patch, err := jsonpatch.CreateMergePatch(oldData, newData)
|
|
|
|
patch, err := jsonpatch.CreateMergePatch(oldData, newData)
|
|
|
|
return patch, types.MergePatchType, err
|
|
|
|
return patch, types.MergePatchType, err
|
|
|
|
case err != nil:
|
|
|
|
}
|
|
|
|
return nil, types.StrategicMergePatchType, goerrors.Wrap(err, "failed to get versionedObject")
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
patch, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, versionedObject)
|
|
|
|
patch, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, versionedObject)
|
|
|
|
return patch, types.StrategicMergePatchType, err
|
|
|
|
return patch, types.StrategicMergePatchType, err
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, force, recreate bool) error {
|
|
|
|
func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, force, recreate bool) error {
|
|
|
|