Skip to content

WebPage better showcase Standalone Dependent Resource #1111

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 11 commits into from
Apr 1, 2022
Merged

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Mar 31, 2022

No description provided.

@@ -113,6 +118,16 @@ public WebPageReconciler(KubernetesClient kubernetesClient) {
kubernetesClient.services().inNamespace(ns).createOrReplace(desiredService);
}

var existingIngress = context.getSecondaryResource(Ingress.class);
if (Boolean.TRUE.equals(webPage.getSpec().getExposed())) {
var desiredIngress = makeDesiredIngress(webPage);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should put the desired state in the context 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.

Hmm, I don't see why, or what would be the purpose/benefit?
it can change based on the actual custom resource values.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The purpose would be to avoid that rather ugly makeDesiredIngress static method :)
Outside of the scope for this release, though, for sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is there just to share code between WebPageReconciler and WebPageStandaloneReconciler

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should avoid recomputing the desired state several times.

Copy link
Collaborator Author

@csviri csviri Apr 1, 2022

Choose a reason for hiding this comment

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

I don't get it, it's just computed once in single a run. We have to recompute on each run since the custom resource might change that means the desired state might change (generally speaking).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But we can take a look later, pls create an issue if you think this is important to discuss.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's the kind of use case that the AbstractDependentResource.isCreatable method was supposed to fix: make it possible for dependents to be created based not only statically (whether the associated implementation implements Creator) but also dynamically based on the primary resource content. Not sure why you wanted to remove it, actually…

Copy link
Collaborator Author

@csviri csviri Apr 1, 2022

Choose a reason for hiding this comment

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

I really don't understand what is the problem we are solving. This sample does not use dependent resources at all.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@csviri csviri force-pushed the webpage-standalone branch from 0f34d36 to 988e13a Compare April 1, 2022 06:46
@csviri csviri marked this pull request as ready for review April 1, 2022 06:46
@csviri csviri requested a review from metacosm April 1, 2022 07:06
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 1, 2022

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

@csviri csviri merged commit 4d63e12 into main Apr 1, 2022
@csviri csviri deleted the webpage-standalone branch April 1, 2022 11:59
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.

Enhance WebPageStandaloneDependentsReconciler to better show capabilities of standalone mode
2 participants