diff --git a/hack/unwanted-dependencies.json b/hack/unwanted-dependencies.json index 82c53a8754d..31dafc3c8a4 100644 --- a/hack/unwanted-dependencies.json +++ b/hack/unwanted-dependencies.json @@ -20,6 +20,7 @@ "github.com/bketelsen/crypt": "unused, crypto", "github.com/containerd/cgroups": "standardize on single cgroups library from runc, refer #128157", "github.com/davecgh/go-spew": "refer to #103942", + "github.com/evanphx/json-patch/v5": "refer to https://github.com/kubernetes/kubernetes/pull/91622#issuecomment-637087847", "github.com/form3tech-oss/jwt-go": "unmaintained, archive mode", "github.com/getsentry/raven-go": "unmaintained, archive mode", "github.com/go-bindata/go-bindata": "refer to #99829", diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go index c7bcb7f5923..7f4b1f3e62d 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest_test.go @@ -29,6 +29,7 @@ import ( "github.com/google/go-cmp/cmp" jsonpatch "gopkg.in/evanphx/json-patch.v4" + apiequality "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -249,6 +250,15 @@ func TestJSONPatch(t *testing.T) { name: "valid-negative-index-patch", patch: `[{"op": "test", "value": "foo", "path": "/metadata/finalizers/-1"}]`, }, + // This demonstrates out-of-spec behavior json-patch v4 allows, + // which Kubernetes clients may depend on, and which updating to json-patch v5 currently breaks + { + name: "replace-missing-path-allowed", + patch: `[ + {"op":"replace", "path":"/metadata/path", "value":"foo"}, + {"op":"test", "path":"/metadata/path", "value":"foo"} + ]`, + }, } { p := &patcher{ patchType: types.JSONPatchType,