Commit Graph

8 Commits

Author SHA1 Message Date
Markus Thömmes 0e61d6763d
Bump assorted dependencies (#2140) 2021-06-02 02:50:30 -07:00
Markus Thömmes 4da0479cf9
Use the correct module import for 'gopkg.in/evanphx/json-patch.v4' (#1868) 2020-10-28 04:19:34 -07:00
cshou 1cc3c3e852
Update jsonpatch lib that correctly handle object removal (#1078)
* update jsonpatch lib

* add more patch tests for removal
2020-02-12 08:27:22 -08:00
Dan Gerdesmeier d8d1bc2718 Move duck patch helper function from Knative Serving to pkg (#681)
We have been maintaining a copy of this helper function in the Knative
Serving tests. Moving it here and adding tests so it can be used more
generally. The function allows creating a []byte patch without having to
check two levels of error conditions.
2019-09-15 21:35:40 -07:00
Matt Moore 0e41760cea Undo the patch sorting. (#192)
My prior change added sorting to the duck.CreatePatch method to try and stabilize the result of jsonpatch.CreatePatch, which is otherwise non-deterministic (probably walking a map?).

My bad assumption was that the patch operations this generated wouldn't conflict, e.g. it should use `replace` vs. `remove` and `add`.

Clearly this was bad because we start getting really strange errors trying to import this into knative/serving, e.g.
https://gubernator.knative.dev/build/knative-prow/pr-logs/pull/knative_serving/2646/pull-knative-serving-integration-tests/1070435951391543298/
2018-12-05 15:04:26 -08:00
Matt Moore c267dfecb7 This exempts defaulting from the rules governing field immutability. (#191)
Immutable fields with default values may now be changed iff they change is to populate their default value.  This is to support defaulting in the scenario where an object was created long ago and a new field (with a default!) is added.  When controllers attempt to mutate the object status today, this would create a webhook rejection!  With this change, we compare against a freshly defaulted "old" object to exclude newly defaulted fields from the immutability check.

We saw this in knative/serving for the newly added TimeoutSeconds field in Revision (otherwise immutable), which I believe it leading to upgrade testing flakes since post-upgrade Revision status updates will fail.
2018-12-05 13:40:26 -08:00
Gregory Haynes 594df37bfd Add support for StrategicMergePatch to duck (#145)
K8s fake clients only support StrategicMergePatches so we should be
creating patches in this format.

Fixes #144
2018-10-26 17:06:32 -07:00
Matt Moore e71b1a477d Create a helper for synthesizing patches. (#87) 2018-09-24 15:36:20 -07:00