| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
@metacosm @shawkins @xstefank This approach however would be bulletproof if we handle the re-list in the informer from the fabric8 pr above. Since in some (rather extreme) edge cases, if there is a re-list, event might be lost. So the idea would be (will create a separate PR) that, if we got notified that goind to be a re-list we flip a switch, and until the sync is finished we simply allow to pass (don't filter) any events. I think without that this is not even possible to do 100% correctly. (but maybe @shawkins has some ideas) https://github.com/fabric8io/kubernetes-client/pull/7899/changes So this is the correct way of doing, with "maximal precision", the good think is that it is actually relatively simple.
|
Sorry, something went wrong.
|
added #3406 that covers the informer re-list, will continue now adding unit tests etc. |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR updates the event-filtering/temporary-cache logic to better support read-after-write consistency by distinguishing “own” updates from external/intermediate updates, and adds a regression integration test covering deletion racing with a status update.
Changes:
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file| File | Description |
|---|---|
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateStatus.java | Adds a status POJO used by the new deletion-vs-status-update regression test. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateReconciler.java | Test reconciler that forces a controlled race between status patching and deletion. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateIT.java | New regression IT ensuring cleanup is triggered when delete races with status update. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateCustomResource.java | New CR type used by the regression IT. |
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/TemporaryResourceCacheTest.java | Updates/extends cache tests for the new Optional<GenericResourceEvent> behavior and intermediate-event handling. |
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSourceTest.java | Updates informer event source tests; adds repeated tests and new intermediate-event scenarios. |
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSourceTest.java | Adds controller-level tests for intermediate-event propagation/deferral during filtering. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/TemporaryResourceCache.java | Core behavior change: event filtering, own-version tracking, and intermediate-event propagation logic. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java | Adapts update+cache flow to new doneEventFilterModify contract and event propagation. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java | Adapts informer callbacks to new Optional<GenericResourceEvent> and propagates the event payload. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/GenericResourceEvent.java | Introduces GenericResourceEvent payload used by the new filtering logic. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/EventFilterDetails.java | Refactors tracking to store related events and “own” resourceVersions to decide propagation/summary behavior. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSource.java | Updates controller event handling to use Optional<GenericResourceEvent> and the new delete handling path. |
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/GenericResourceEvent.java:31
Sorry, something went wrong.
| if (comp == 0) { | ||
| result = Optional.empty(); | ||
| } |
There was a problem hiding this comment.
This is not true IMO, it can happen that we received a delete, them the resource was re-created, but will think about this.
Sorry, something went wrong.
|
@shawkins was thinking about this more, and having optimistic locking would be a too strong restriction in my opinion, compared to that even not doing event filtering is a better option. So I prepared this PR and the one that we can merge subsequently: With these two we would cover this functionality by just filtering events directly related to our updates, or not do filtering when there is a relist going on. If the complexity would be proven to an issue and we would still hit some problematic cases, as an alternative we could just do a heuristic that would be very simple:
But for both alternatives, we at the end need to be aware that re-list happened and events might be lost, so regardless we would need this: please let me know what do you think. Will finalize the PRs today. cc @manusa |
Sorry, something went wrong.
|
Just one thought about the complexity, yes these algorithms are not trivial, but also would make it much easier for the users to implement reconciliation logic. So there is such complexity in the framework or at the end in some cases in the reconcilers, so having these problems solved by is where the frameworks are really useful. |
Sorry, something went wrong.
| private final Boolean lastStateUnknow; | ||
|
|
||
| public ExtendedResourceEvent( | ||
| public GenericResourceEvent( |
There was a problem hiding this comment.
We shouldn't do this kind of renames of public classes in minors
Sorry, something went wrong.
There was a problem hiding this comment.
This is strictly internal class. Maybe we should explicitly annotate public APIs
Sorry, something went wrong.
| return; | ||
| } | ||
| if (resultEvent.orElseThrow().getAction() != ResourceAction.DELETED) { | ||
| log.warn("Non delete event received on onDelete handling. This should not happen."); |
There was a problem hiding this comment.
| log.warn("Non delete event received on onDelete handling. This should not happen."); | |
| log.warn("An event which is not a delete event recieved in onDelete handling. This should not happen."); |
Sorry, something went wrong.
There was a problem hiding this comment.
maybe we should also log the real event received
Sorry, something went wrong.
There was a problem hiding this comment.
We don't want to log the whole event, that might even contain sensitive enformation (think of k8s Secrets). We already logging metadata with MDC.
Sorry, something went wrong.
There was a problem hiding this comment.
Copilot reviewed 28 out of 28 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/GenericResourceEvent.java:31
Sorry, something went wrong.
| if (comp == 0) { | ||
| result = Optional.empty(); | ||
| } |
| var resultEvent = | ||
| temporaryResourceCache.onDeleteEvent(resource, deletedFinalStateUnknown); | ||
| if (resultEvent.isEmpty()) { | ||
| return; | ||
| } | ||
| if (resultEvent.orElseThrow().getAction() != ResourceAction.DELETED) { | ||
| log.warn("Non delete event received on onDelete handling. This should not happen."); | ||
| } | ||
| primaryToSecondaryIndex.onDelete(resource); |
| } else if (eventAcceptedByFilter(action, newObject, oldObject)) { | ||
| log.debug( | ||
| "Propagating event for {}, resource with same version not result of a reconciliation.", | ||
| "Propagating event for {}, resource with same version not result of a our update.", | ||
| action); |
| if (log.isDebugEnabled()) { | ||
| log.debug("Event received with action: {}", action); | ||
| log.trace("Event Old resource: {},\n new resource: {}", oldResource, resource); | ||
| log.debug("Event Old resource: {},\n new resource: {}", oldResource, resource); | ||
| } |
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
| Back | FazBrowse Home | New Git URL |
Signed-off-by: Attila Mészáros a_meszaros@apple.com