allthingssecurity commented on PR #29893: URL: https://github.com/apache/camel/pull/29893#issuecomment-6875852963
Thanks @davsclaus, all four points are in 2fa913579fa5. **[Important] handover after a stop.** Taken your first option. The informer now has `.exceptionHandler((started, t) -> started)`, so once it is started fabric8 retries any error by itself and lists again after a watch error, and the informer is stopped only when the task stops. I checked it against the 8.0.0 jars with javap: `SharedIndexInformer.exceptionHandler(ExceptionHandler)` with `boolean retryAfterException(boolean isStarted, Throwable t)`; `Reflector.onException` passes "start future done and not failed" as `isStarted`, and on true calls `reconnect()` (exponential backoff), else completes the start and stop futures exceptionally. The default handler is `isStarted && !(t instanceof WatcherException)`, which is why a watch error other than 410 stopped it. The loop now only starts a new informer when one fails to start, with the 1 s to 30 s backoff, and each informer gets its own store, so nothing can hide in the store of a previous one. Test: `KubernetesInformerLoopTest.testUpdateQueuedWhileTheHandlerIsBusyIsReportedAfterAWatchError`. The handler blocks on the first update (as a reload would), a second update arrives and is queued, then the watch gets an event that is not a resource (a watch error other than 410), and the test waits until the client has closed that watch before it releases the handler. The queued update must still come, and the busy handler must not be interrupted. One thing I saw while writing it: fabric8 runs the re-list on the same serial executor as the handler, so after a watch error the informer lists again only once the reload in progress is done. Without the exception handler it fails (`the queued update of my-b was dropped ==> expected: <my-b> but was: <null>`, and the earlier restart test fails too). The earlier restart test is now `testUpdateMadeBeforeAWatchErrorOtherThanGoneIsReported`: the informer lists again by itself. **[Suggestion] what the store keeps.** Each informer's store is a `ReducedStateItemStore` (in 8.0.0, with `NAME_KEY_STATE`), subclassed to skip names that do not match. It keeps only the name, namespace and resource version, which is what `ProcessorStore` compares, so the Secret data stays out of the long-lived cache. `onUpdate` still gets the full new object from the event, used only for its name. **[Suggestion] upgrade guide.** Added: the `list` permission does not widen what the ServiceAccount can read, as the old watch had no resource version and already got every existing Secret (or ConfigMap) as an ADDED event. **[Nit] stop test.** `testStopWhileTheInformerStartsEndsTheLoop` now asserts no watch with Awaitility `during(4 s)`, past the 3 s delay of the list. Tests: `KubernetesInformerLoopTest` 7, `SecretsReloadTriggerTaskWatchClosedTest` 5, `ConfigmapsReloadTriggerTaskWatchClosedTest` 5, all pass; without the exception handler 2 of the 7 loop tests fail. The PR description is updated to match. _Claude Code on behalf of allthingssecurity_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
