feat: add withoutDefaultFilters option to skip JOSDK internal update …#3438
feat: add withoutDefaultFilters option to skip JOSDK internal update …#3438xstefank wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new controller configuration switch to let users fully control UPDATE-event filtering (instead of having JOSDK’s internal update filters always AND-ed in), addressing the “logical OR” filtering use case described in issue #3413 (e.g., generation-aware updates OR a specific status/metadata change).
Changes:
- Introduces
withoutDefaultFilterson@ControllerConfigurationand propagates it through resolved/runtime configuration. - Updates
ControllerEventSourceto skip internal UPDATE filters whenwithoutDefaultFiltersis enabled. - Exposes internal filter builders via
InternalEventFiltersand adds unit/integration tests demonstrating behavior.
Reviewed changes
Copilot reviewed 11 out of 11 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/WithoutDefaultFiltersUpdateFilter.java | Adds a composed user update filter (example) using InternalEventFilters + custom logic. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/WithoutDefaultFiltersReconciler.java | Adds a test reconciler configured with withoutDefaultFilters = true. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/filter/WithoutDefaultFiltersIT.java | Adds an IT validating user-controlled UPDATE filtering when defaults are skipped. |
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSourceTest.java | Adds unit tests ensuring user filter is applied directly when defaults are skipped. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/controller/InternalEventFilters.java | Makes internal filter helpers public so users can explicitly compose default behavior. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/controller/ControllerEventSource.java | Implements the new withoutDefaultFilters behavior in the controller event source. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java | Adds the withoutDefaultFilters annotation attribute + documentation. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ResolvedControllerConfiguration.java | Persists the withoutDefaultFilters flag in resolved configuration. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ControllerConfigurationOverrider.java | Adds an override hook to set withoutDefaultFilters. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ControllerConfiguration.java | Adds isWithoutDefaultFilters() to the runtime configuration interface. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java | Reads withoutDefaultFilters from the annotation and wires it into resolved config. |
| if (config.isWithoutDefaultFilters()) { | ||
| Optional.ofNullable(informerConfig.getOnUpdateFilter()).ifPresent(this::setOnUpdateFilter); | ||
| } else { |
| res.getMetadata() | ||
| .setAnnotations(Map.of(WithoutDefaultFiltersReconciler.TRIGGER_ANNOTATION, "true")); | ||
| operator.replace(res); |
…filters Signed-off-by: xstefank <xstefank122@gmail.com>
3cb5488 to
3be046b
Compare
| return false; | ||
| } | ||
|
|
||
| default boolean isWithoutDefaultFilters() { |
There was a problem hiding this comment.
Wonder if we could improve the naming of this flag. Like useDefaultFilters / addDefaultFilters or just defaultFilters ?
| @@ -22,15 +22,15 @@ public class InternalEventFilters { | |||
|
|
|||
| private InternalEventFilters() {} | |||
|
|
|||
There was a problem hiding this comment.
What we could do is to add here a static method "defaultFilters" that returns a composition of the default filters - later also we could use in ControllerEventSource.
Fixes #3413