Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Apr 9, 2025

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

@metacosm metacosm self-assigned this Apr 9, 2025
@metacosm metacosm requested review from csviri and xstefank April 9, 2025 17:58
@@ -54,6 +62,13 @@ public void configureWith(KubernetesDependentResourceConfig<R> config) {
this.kubernetesDependentResourceConfig = config;
}

public void setMatcher(SSABasedGenericKubernetesResourceMatcher<R> matcher) {
if (this.matcher != defaultMatcher) {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

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 you don't need to keep the defaultMatcherin 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.

Copy link
Collaborator Author

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

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 =
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

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.

3 participants