diff --git a/CHANGELOG.md b/CHANGELOG.md index 074a2f52e3..f74e4a4b3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ * Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified * Fix #4312: fix timestamp can't be deserialized for IstioCondition * Fix #4369: Informers will retry with a backoff on list/watch failure as they did in 5.12 and prior. -* Fix #4426: [java-generator] Encode an `AnyType` instead of an Object if `x-kubernetes-preserve-unknown-fields` is present and the type is null. +* 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. * Fix #4442: TokenRefreshInterceptor doesn't overwrite existing OAuth token with empty string * Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy. @@ -45,6 +46,7 @@ * Fix #3924: Extension Mock modules have been removed * Fix #4384: javax.validation.* annotations are no longer added by the Java generator. * Fix #3906: removed BaseKubernetesList, use KubernetesList instead +* Fix #4408: deprecated SharedInformerFactory.addSharedInformerEventListener, instead use the SharedIndexInformer.stopped method. Also the signature of SharedIndexInformer.start was changed to a CompletionStage rather than a CompletableFuture. ### 5.12.4 (2022-09-30) diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedIndexInformer.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedIndexInformer.java index 9b5a071fba..0d76965195 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedIndexInformer.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedIndexInformer.java @@ -175,7 +175,7 @@ default boolean hasSynced() { /** * Sets the {@link ExceptionHandler} for this informer. For example, exceptionHandler((b, t) -> true)), will - * keep retying no matter what the exception is. + * keep retrying no matter what the exception is. *

* May only be called prior to the informer starting * diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedInformerFactory.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedInformerFactory.java index 6399ab79b7..59379c335d 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedInformerFactory.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/informers/SharedInformerFactory.java @@ -81,6 +81,10 @@ SharedIndexInformer sharedIndexInformerFor(Class a */ void stopAllRegisteredInformers(); + /** + * @deprecated use {@link SharedIndexInformer#stopped()} method to get notified when an informer stops. + */ + @Deprecated void addSharedInformerEventListener(SharedInformerEventListener event); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CustomResourceInformerExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CustomResourceInformerExample.java index d6df9b1dce..44543d482c 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CustomResourceInformerExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CustomResourceInformerExample.java @@ -56,8 +56,11 @@ public void onDelete(Dummy pod, boolean deletedFinalStateUnknown) { } }); - sharedInformerFactory - .addSharedInformerEventListener(ex -> logger.error("Exception occurred, but caught: {}", ex.getMessage())); + podInformer.stopped().whenComplete((v, t) -> { + if (t != null) { + logger.error("Exception occurred, caught: {}", t.getMessage()); + } + }); logger.info("Starting all registered informers"); sharedInformerFactory.startAllRegisteredInformers();