Skip to content

fix: same as controller config for KubernetesDependentResource standalone #1222

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 2 commits into from
May 18, 2022

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented May 18, 2022

No description provided.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@@ -49,12 +51,17 @@ public KubernetesDependentResource(Class<R> resourceType) {

@Override
public void configureWith(KubernetesDependentResourceConfig config) {
configureWith(config.labelSelector(), config.namespaces(), !config.wereNamespacesConfigured());
this.kubernetesDependentResourceConfig = config;
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 we call configureWith(…) here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we dont, have the context here, so we don't know the controller namespaces. So it cannot be done at this time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So when is it done, then? The expectation with the configureWith methods is that once they're called, the dependent resource is set up. In this case, this isn't true anymore and someone calling this method would need to call one of the other versions at some later time…

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see comment below

configureWith(null, context.getControllerConfiguration().getNamespaces(), true);
log.warn("Using default configuration for " + resourceType().getSimpleName()
+ " KubernetesDependentResource, call configureWith to provide configuration");
if (kubernetesDependentResourceConfig != null) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@metacosm it's done here, when the event source is created.

Copy link
Collaborator

Choose a reason for hiding this comment

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

🤔 I saw that but wasn't convinced there wasn't a path where this wouldn't get called… But I guess createEventSource is always called so we should be good! Thanks!

@metacosm metacosm self-requested a review May 18, 2022 13:44
@csviri csviri merged commit 9136f31 into main May 18, 2022
@csviri csviri deleted the configure-with-standalone branch May 18, 2022 13:54
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.

Using configureWith(KubernetesDependentResourceConfig) Standalone KubernetesDependentResource issue
2 participants