-
Notifications
You must be signed in to change notification settings - Fork 218
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
Conversation
1b8aae5
to
4c776aa
Compare
309d3b7
to
db3b7e1
Compare
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
261e5f5
to
99ca7e2
Compare
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
...ore/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java
Show resolved
Hide resolved
.../src/main/java/io/javaoperatorsdk/operator/sample/WebPageStandaloneDependentsReconciler.java
Show resolved
Hide resolved
@@ -21,56 +24,60 @@ | |||
String name() default NO_VALUE_SET; |
There was a problem hiding this comment.
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 :(
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
I don't see any changes. Did you push them?
Maybe. |
Thanks, I will open a subsequent PR to clean things up and rename things more appropriately. |
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
#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]>
No description provided.