Merge pull request #7269 from adriangonz/fix-crd-update

Add back fix for CRD patch creation
pull/7286/head
Taylor Thomas 5 years ago committed by GitHub
commit df13e24513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -355,7 +355,12 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P
// returned from ConvertToVersion. Anything that's unstructured should
// use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported
// on objects like CRDs.
if _, ok := versionedObject.(runtime.Unstructured); ok {
_, isUnstructured := versionedObject.(runtime.Unstructured)
// On newer K8s versions, CRDs aren't unstructured but has this dedicated type
_, isCRD := versionedObject.(*apiextv1beta1.CustomResourceDefinition)
if isUnstructured || isCRD {
// fall back to generic JSON merge patch
patch, err := jsonpatch.CreateMergePatch(oldData, newData)
return patch, types.MergePatchType, err

Loading…
Cancel
Save