Skip to content

feat: workflows can be created without associated dependent resource #1632

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 19 commits into from
Dec 2, 2022

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Nov 25, 2022

This allows for the workflow graph to be resolved at build time from a
factory, the dependent resources being configured as needed at runtime
via the resolve mechanism.

@metacosm metacosm self-assigned this Nov 25, 2022
@metacosm metacosm requested a review from csviri November 25, 2022 18:41
@metacosm metacosm marked this pull request as ready for review November 27, 2022 13:11
Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

Apart from little naming LGTM

@@ -64,4 +64,8 @@ default Optional<R> getSecondaryResource(P primary, Context<P> context) {
static String defaultNameFor(Class<? extends DependentResource> dependentResourceClass) {
return dependentResourceClass.getName();
}

static boolean canDeleteIfAble(DependentResource<?, ?> dependentResource) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this naming somehow feels strange

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What would you name it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

deletable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also problem here is that GarbageCollected is only applicatble for KubernetesDependentResource, so it is little smelly that it's on this layer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, wasn't too sure where to put it but the problem is that the code in this method was spread at different spots that didn't have anything to do with KubernetesDependentResource either so it's less smelly now than it was.

@@ -64,4 +64,8 @@ default Optional<R> getSecondaryResource(P primary, Context<P> context) {
static String defaultNameFor(Class<? extends DependentResource> dependentResourceClass) {
return dependentResourceClass.getName();
}

static boolean canDeleteIfAble(DependentResource<?, ?> dependentResource) {
return dependentResource instanceof Deleter && !(dependentResource instanceof GarbageCollected);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would rather just check Deleter here. And override this is KubernetesDependentResource and check there also the GarbageCOllected as here. So it more expresses that GarbageCollected just applies on KubernetesDependentResource

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This isn't the case in the tests, though…

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm where exactly?

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 0a1a381

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 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 6 Code Smells

81.9% 81.9% Coverage
0.0% 0.0% Duplication

@metacosm metacosm requested a review from csviri December 2, 2022 11:21
Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

LGTM

@metacosm metacosm merged commit 0fc616f into main Dec 2, 2022
@metacosm metacosm deleted the deferred-workflow branch December 2, 2022 11:49
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.

2 participants