feat: add onUpdateFilterCombinedWithOr option to ControllerConfiguration#3437
feat: add onUpdateFilterCombinedWithOr option to ControllerConfiguration#3437xstefank wants to merge 1 commit into
Conversation
Signed-off-by: xstefank <xstefank122@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a new controller configuration option to combine user-provided OnUpdateFilter logic with JOSDK’s internal update filters using OR (instead of the current AND), enabling reconciliation on selected status-only updates while keeping generation-aware filtering enabled (addresses #3413).
Changes:
- Introduces
onUpdateFilterCombinedWithOron@ControllerConfigurationand propagates it through resolved/overridden controller configuration. - Updates
ControllerEventSourceto combine user/internal update filters with OR when configured. - Adds unit + integration tests covering the new OR-combination behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSource.java | Applies OR vs AND composition for user/internal update filters based on new config flag. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java | Adds the onUpdateFilterCombinedWithOr annotation attribute and documents behavior. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ResolvedControllerConfiguration.java | Stores and exposes the resolved OR-combination flag. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ControllerConfigurationOverrider.java | Allows overriding the OR-combination flag programmatically. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ControllerConfiguration.java | Adds default accessor isOnUpdateFilterCombinedWithOr() to config interface. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java | Reads the new annotation attribute and wires it into resolved configuration. |
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSourceTest.java | Adds unit tests validating OR behavior at the event source level. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/OrCombinedUpdateFilter.java | Test filter used to validate OR-combination behavior in an IT scenario. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/OrCombinedFilterTestReconciler.java | Test reconciler configured with onUpdateFilterCombinedWithOr = true. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/OrCombinedFilterIT.java | Integration test demonstrating reconcile triggers on status/metadata-only updates via OR. |
| filter -> { | ||
| if (config.isOnUpdateFilterCombinedWithOr()) { | ||
| setOnUpdateFilter(filter.or(internalOnUpdateFilter)); | ||
| } else { | ||
| setOnUpdateFilter(filter.and(internalOnUpdateFilter)); | ||
| } | ||
| }, |
csviri
left a comment
There was a problem hiding this comment.
@xstefank please target next branch with the features.
As I mentioned on the other PR I would prefer rather a flag for not adding filters, and user can customize fully.
Note that this way is not very future proof either, since we just talking here about in Update filters in the PR, where current filters happens to be update that we set by default, but this might change in any release, so then we would need to change/add a new config param. What we should try to avoid.
Fixes #3413