Skip to content

feat: move controller informer-related configuration to InformerConfig #2455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 8, 2024

Conversation

metacosm
Copy link
Collaborator

No description provided.

@metacosm metacosm self-assigned this Jun 25, 2024
@metacosm metacosm requested a review from csviri June 25, 2024 12:42
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 25, 2024
@metacosm metacosm force-pushed the controller-informer branch 2 times, most recently from 1b8aae5 to 4c776aa Compare June 26, 2024 12:14
@metacosm metacosm marked this pull request as ready for review June 27, 2024 20:01
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 27, 2024
@openshift-ci openshift-ci bot requested review from adam-sandor and andreaTP June 27, 2024 20:01
@metacosm metacosm force-pushed the controller-informer branch from 309d3b7 to db3b7e1 Compare July 1, 2024 11:11
@metacosm metacosm force-pushed the controller-informer branch from 261e5f5 to 99ca7e2 Compare July 2, 2024 20:30
Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

Made some changes, I think we should discuss mainly some naming and API issues mentioned, mainly the one related to the followControllerNamespacesOnChange.

Shall we just document that, that it is a problem. Maybe we can check and throw an exception if that is set explicitly for the controller?!

.build(), context);
var serviceEventSource =
new InformerEventSource<>(InformerConfiguration.from(Service.class, WebPage.class)
.withLabelSelector(SELECTOR)
.withInformerConfiguration(c -> c.withLabelSelector(SELECTOR))
.build(), context);
var ingressEventSource =
new InformerEventSource<>(InformerConfiguration.from(Ingress.class, WebPage.class)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels little weird, maybe just naming issue but

InformerConfiguration.from(..).withInformerConfiguraiton(...) somehow does not sounds right.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Here we could just simply hide the holder, and put back the with* methods that would result a simpler / cleaner API.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea is to reuse the same code at some point to deal with the InformerConfig… and yes, the naming is sub-optimal, which is why I'd like to clean things up but I'd rather do that in a subsequent PR

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, we could just let the old methods, like here, the withLabelSelector will be in the background the InformerConfigHolder. Would be good to have this in this PR, this is something I would not release for sure. But if you insist feel free to do separately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I had tried that (or some variation of it) but maybe I didn't. Let me see what it does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would re-add these methods after we're done with renaming and cleaning-up if we feel it's necessary.

@@ -21,56 +24,60 @@
String name() default NO_VALUE_SET;
Copy link
Collaborator

@csviri csviri Jul 4, 2024

Choose a reason for hiding this comment

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

name does not makes too much sense for the controller either :(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wondered about this, actually, if we could somehow reuse the same config for the controller and some other event source but yes, I agree that this doesn't make much sense for the controller.

The problem is that we cannot inherit between annotations so either:

  • we have separate annotations that do more or less the same thing with code to process each that will again more or less do the same thing, which will cause quite a big maintenance load
  • we accept that some of the setup doesn't make sense for both, add proper safeguards and live with it
  • we extract the fields that don't make sense in a different annotation for event sources that will enclose an InformerConfig field but that adds yet another level of annotations, which would be less than ideal.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Exactly, imo 1. or 2.
Not sure if that is that much more code to have a @ControllerInformer.

Or alternative is also just simply stick with the current approach and don't merge this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I would prefer 2. at this point, with more clean up on the naming, it should be much better, I just wanted to control the blast radius at this point :)

@metacosm
Copy link
Collaborator Author

metacosm commented Jul 4, 2024

Made some changes, I think we should discuss mainly some naming and API issues mentioned, mainly the one related to the followControllerNamespacesOnChange.

I don't see any changes. Did you push them?

Shall we just document that, that it is a problem. Maybe we can check and throw an exception if that is set explicitly for the controller?!

Maybe.

@metacosm
Copy link
Collaborator Author

metacosm commented Jul 8, 2024

Thanks, I will open a subsequent PR to clean things up and rename things more appropriately.

@metacosm metacosm merged commit 534daaf into next Jul 8, 2024
20 checks passed
@metacosm metacosm deleted the controller-informer branch July 8, 2024 13:56
@csviri csviri linked an issue Jul 8, 2024 that may be closed by this pull request
metacosm added a commit that referenced this pull request Jul 8, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Jul 9, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Jul 12, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
csviri pushed a commit that referenced this pull request Aug 8, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
csviri pushed a commit that referenced this pull request Aug 15, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Aug 29, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
csviri pushed a commit that referenced this pull request Sep 20, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Oct 10, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Nov 5, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Nov 6, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
csviri pushed a commit that referenced this pull request Nov 13, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Nov 19, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Nov 20, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
metacosm added a commit that referenced this pull request Nov 27, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
csviri pushed a commit that referenced this pull request Dec 6, 2024
#2455)

* feat: move controller informer-related configuration to InformerConfig

Signed-off-by: Chris Laprun <[email protected]>

* refactor: start isolating ResourceConfiguration

Signed-off-by: Chris Laprun <[email protected]>

* fix: initFromAnnotation now properly inits the current instance

Signed-off-by: Chris Laprun <[email protected]>

* fix: default onDeleteFilter implementation

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly set default namespaces in controller case

Signed-off-by: Chris Laprun <[email protected]>

* refactor: remove KubernetesDependentInformerConfigBuilder

Signed-off-by: Chris Laprun <[email protected]>

* refactor: use InformerConfigHolder in more places, unifying handling

Signed-off-by: Chris Laprun <[email protected]>

* fix: properly propagate name to informer config

Signed-off-by: Chris Laprun <[email protected]>

* feat: add factory method to init builder from an extising configuation

Signed-off-by: Chris Laprun <[email protected]>

* fix: remove potentially problematic default implementation

Signed-off-by: Chris Laprun <[email protected]>

---------

Signed-off-by: Chris Laprun <[email protected]>
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.

Use @InformerConfig in @ControllerConfiguration
2 participants