Skip to content

fix: add onUpdateFilterOr option to the Informer#3436

Open
xstefank wants to merge 1 commit into
operator-framework:mainfrom
xstefank:event-source-filter
Open

fix: add onUpdateFilterOr option to the Informer#3436
xstefank wants to merge 1 commit into
operator-framework:mainfrom
xstefank:event-source-filter

Conversation

@xstefank

Copy link
Copy Markdown
Collaborator

Fixes #3413

Signed-off-by: xstefank <xstefank122@gmail.com>
Copilot AI review requested due to automatic review settings June 22, 2026 14:25
@openshift-ci openshift-ci Bot requested review from csviri and metacosm June 22, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an “OR” update-filter option to informer/controller event filtering so controllers can still be generation-aware while explicitly allowing additional update events (e.g., specific status-path updates done via SSA), addressing #3413.

Changes:

  • Introduces onUpdateFilterOr on @Informer and propagates it through InformerConfiguration / InformerEventSourceConfiguration.
  • Updates ControllerEventSource to combine filters as (internal AND onUpdateFilter) OR onUpdateFilterOr.
  • Adds unit/integration tests covering the new OR-filter behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/OrUpdateFilter.java Adds a test OnUpdateFilter used to validate OR-filter behavior.
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/OrFilterTestReconciler.java Configures a controller with @Informer(onUpdateFilterOr = ...) for integration testing.
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/OrFilterIT.java Integration test validating OR-filter can trigger reconciliation on updates that internal filters would reject.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSourceTest.java Unit tests for OR-filter behavior and updated controller test wiring.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSource.java Implements the effective filter composition with optional OR-filter support.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java Adds builder support and propagation for withOnUpdateFilterOr.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java Adds storage, builder methods, and annotation initialization for onUpdateFilterOr.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/Informer.java Adds onUpdateFilterOr() to the annotation and documents intended behavior.

Comment on lines +93 to +97
* Optional {@link OnUpdateFilter} combined with JOSDK's internal filters using OR logic — the
* event is accepted when either this filter or JOSDK's internal filters accept it. Use this to
* expand the set of events that trigger reconciliation beyond what JOSDK's internal filters (e.g.
* generation-aware filtering) would normally allow, for instance to also reconcile on specific
* status field updates.
Comment on lines +71 to +73
await()
.pollDelay(Duration.ofMillis(POLL_DELAY))
.untilAsserted(() -> assertThat(reconciler().getNumberOfExecutions()).isEqualTo(3));
@metacosm

Copy link
Copy Markdown
Collaborator

Maybe it would make more sense to have a switch to change the composition behavior from AND to OR instead of defining another filter with a different behavior?

@csviri

csviri commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

@xstefank I see more conceptual issues with this approach. One is what @metacosm mentioned:

Maybe it would make more sense to have a switch to change the composition behavior from AND to OR instead of defining another filter with a different behavior?

and yes I think too, that would be one way to solve this.

Another approach would be to have a flag to "withoutDefaultFilters", so default filters don't interfere with the users, so user would have a full control of the filters, that would be future-proof, also might impose a simpler mental model.

In addition to that this should not be on Informer level, since it only make sense in context of ControllerEventSource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support SSA in InformerEventSource, listen to specific status updates

4 participants