diff --git a/go.mod b/go.mod index 3f470e9d3..752614539 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,6 @@ require ( github.com/docker/distribution v2.7.1+incompatible github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible github.com/docker/go-units v0.4.0 - github.com/evanphx/json-patch v4.9.0+incompatible github.com/gobwas/glob v0.2.3 github.com/gofrs/flock v0.8.0 github.com/gosuri/uitable v0.0.4 diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 76a832b0e..253f180b6 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -27,7 +27,6 @@ import ( "sync" "time" - jsonpatch "github.com/evanphx/json-patch" "github.com/pkg/errors" batch "k8s.io/api/batch/v1" v1 "k8s.io/api/core/v1" @@ -41,6 +40,7 @@ import ( "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/jsonmergepatch" "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/watch" "k8s.io/cli-runtime/pkg/genericclioptions" @@ -445,7 +445,7 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P // Unstructured objects, such as CRDs, may not have an not registered error // returned from ConvertToVersion. Anything that's unstructured should - // use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported + // use the jsonmergepatch.CreateThreeWayJSONMergePatch. Strategic Merge Patch is not supported // on objects like CRDs. _, isUnstructured := versionedObject.(runtime.Unstructured) @@ -454,7 +454,7 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P if isUnstructured || isCRD { // fall back to generic JSON merge patch - patch, err := jsonpatch.CreateMergePatch(oldData, newData) + patch, err := jsonmergepatch.CreateThreeWayJSONMergePatch(oldData, newData, currentData) return patch, types.MergePatchType, err }