diff --git a/CHANGELOG.md b/CHANGELOG.md index 2640f535694..97448c0856d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Fix #4369: Informers will retry with a backoff on list/watch failure as they did in 5.12 and prior. * Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy. * Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified +* Fix #4441: corrected patch base handling for the patch methods available from a Resource - resource(item).patch() will be evaluated as resource(latest).patch(item). Also undeprecated patch(item), which is consistent with leaving patch(context, item) undeprecated as well. For consistency with the other operations (such as edit), patch(item) will use the context item as the base when available, or the server side item when not. This means that patch(item) is only the same as resource(item).patch() when the patch(item) is called when the context item is missing or is the same as the latest. #### Improvements * Fix #4348: Introduce specific annotations for the generators diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EditReplacePatchable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EditReplacePatchable.java index c47ff3ad27a..da2a76c4270 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EditReplacePatchable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EditReplacePatchable.java @@ -63,20 +63,19 @@ public interface EditReplacePatchable T accept(Consumer function); /** - * Update field(s) of a resource using a JSON patch. + * Update field(s) of a resource using a JSON patch. The patch is computed against the context item. *

* It is the same as calling {@link #patch(PatchContext, Object)} with {@link PatchType#JSON} specified. *

- * WARNING: This may overwrite concurrent changes (between when you obtained your item and the current state) in an unexpected - * way. + * WARNING: If no context item is available the latest version of that resource will be used as the base + * to compute the diff. If you did not intend for the latest version to be your base, this may overwrite + * concurrent changes (between when you obtained your item and the current state) in an unexpected way. *

* Consider using edit, which allows for a known base, and a builder instead. * * @param item to be patched with patched values * @return returns deserialized version of api server response - * @deprecated use resource(item).patch() or edit instead */ - @Deprecated default T patch(T item) { return patch(PatchContext.of(PatchType.JSON), item); } @@ -85,7 +84,7 @@ default T patch(T item) { * Update field(s) of a resource using type specified in {@link PatchContext}(defaults to strategic merge if not specified). * *