-
Notifications
You must be signed in to change notification settings - Fork 218
feat: allow easier configuration of matcher #2760
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Chris Laprun <[email protected]>
...io/javaoperatorsdk/operator/processing/dependent/kubernetes/KubernetesDependentResource.java
Outdated
Show resolved
Hide resolved
@@ -54,6 +62,13 @@ public void configureWith(KubernetesDependentResourceConfig<R> config) { | |||
this.kubernetesDependentResourceConfig = config; | |||
} | |||
|
|||
public void setMatcher(SSABasedGenericKubernetesResourceMatcher<R> matcher) { | |||
if (this.matcher != defaultMatcher) { |
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'm not sure how big the matcher object can be, but this could be a boolean.
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.
Not sure I'm following
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 you don't need to keep the defaultMatcher
in the field if it's only used to verify that the matcher
is set only once. It can be a boolean that is flipped when first set so it's only taking a byte (usually) instead of the size of the defaultMatcher
object.
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.
Yes, figured it out, I have done that change locally, checking with QOSDK before pushing
Signed-off-by: Chris Laprun <[email protected]>
private final boolean garbageCollected = this instanceof GarbageCollected; | ||
private KubernetesDependentResourceConfig<R> kubernetesDependentResourceConfig; | ||
private volatile Boolean useSSA; | ||
|
||
@SuppressWarnings("unchecked") | ||
private SSABasedGenericKubernetesResourceMatcher<R> matcher = defaultMatcher; | ||
private SSABasedGenericKubernetesResourceMatcher<R> matcher = |
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.
Shouldn't this be this rather part of the configuration?
The current approach is that name and class and config are the params and configuration contains everything else. This might go there just as well.
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.
Wanted to keep it simple first but it definitely could go on the config.
Signed-off-by: Chris Laprun [email protected]