Skip to content

feat: allow removing the default namespace index of an informer - #3623

Open
afalhambra-hivemq wants to merge 1 commit into
operator-framework:nextfrom
afalhambra-hivemq:feat/without-namespace-index-3615
Open

afalhambra-hivemq wants to merge 1 commit into
operator-framework:nextfrom
afalhambra-hivemq:feat/without-namespace-index-3615

Conversation

@afalhambra-hivemq

Copy link
Copy Markdown
Contributor

Adds a withoutNamespaceIndex option, on the @Informer annotation and both config builders. When set, the pool calls removeNamespaceIndex() on the informer before starting it.

Couple of things I'd like your opinion on:

  • I made it part of InformerClassifier equality, unlike informerListLimit. The index can't be there for one event source and gone for another on a shared informer, so ones that disagree end up with separate informers, and the pool warns about it.
  • Left it opt in instead of just always dropping the index, since that would change cache behavior for everyone in a minor release. Happy to make it unconditional if you'd rather.

There are unit tests plus WithoutNamespaceIndexIT, and a short docs section. Had to update the informer pool identity list in the docs too.

Unrelated, but I noticed it on the way: InformerEventSourceConfiguration.Builder.updateFrom doesn't copy comparableResourceVersions, so setting it on a dependent gets parsed and then quietly reset to the default. Didn't touch it here, will open a separate issue.

Fixes #3615

Copilot AI lite review requested due to automatic review settings September 17, 2026 15:24
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bfeecbff-aaf5-4145-8d3d-8543bdf79316

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

🟡 Changes recommended

Two moderate compatibility findings and one documentation nit remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds opt-in withoutNamespaceIndex support for informers, removing the default namespace index while preserving pooling correctness.

Changes:

  • Adds annotation and builder configuration.
  • Propagates the option through informer management and pooling.
  • Adds identity handling, warnings, tests, and documentation.
File summaries
File Summary
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/withoutnamespaceindex/WithoutNamespaceIndexTestReconciler.java Configures the integration reconciler for the new option.
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/withoutnamespaceindex/WithoutNamespaceIndexIT.java Adds end-to-end coverage.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/NonSharingInformerPoolTest.java Tests non-sharing pool behavior.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/InformerClassifierTest.java Tests classifier identity handling.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/DefaultInformerPoolTest.java Tests duplicate-cache warning behavior.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/AbstractInformerPoolTest.java Tests namespace-index removal.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerWrapperTest.java Tests informer wrapper behavior.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManagerConcurrentReleaseTest.java Tests concurrent manager release behavior.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/InformerConfigurationTest.java Tests configuration and builder support.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/InformerClassifier.java Includes the option in informer identity. moderate (3 votes): retain the existing nine-argument constructor; nit (2 votes): correct the contradictory list-limit wording.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/DefaultInformerPool.java Warns when differing settings create duplicate caches.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/pool/AbstractInformerPool.java Removes the namespace index before startup.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java Propagates the setting to classifiers.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java Defines the default value.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java Adds event-source builder support.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java Stores and exposes the option. moderate (3 votes): retain the previous protected constructor overload for compatibility.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/Informer.java Adds the annotation option.
docs/content/en/docs/documentation/eventing.md Documents configuration and informer pooling behavior.
Review details
  • Files reviewed: 18/18 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Long informerListLimit,
FieldSelector fieldSelector,
Boolean comparableResourceVersions,
Boolean withoutNamespaceIndex,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd rather not add compatibility overloads here. A constructor that quietly defaults the new field is how config silently goes missing. Leaving it open for @csviri to decide

Long informerListLimit,
ItemStore<R> itemStore) {
ItemStore<R> itemStore,
boolean withoutNamespaceIndex) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as previous one. And I think it would be worse in this case, since the classifier is the informer sharing key, so a caller could build one that silently disagrees about the index.

Signed-off-by: Antonio Fernandez Alhambra <antonio.alhambra@hivemq.com>
@afalhambra-hivemq
afalhambra-hivemq force-pushed the feat/without-namespace-index-3615 branch from 261b940 to c56608c Compare September 17, 2026 15:44
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.

2 participants