-
Notifications
You must be signed in to change notification settings - Fork 219
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
Conversation
This allows for the workflow graph to be resolved at build time from a factory, the dependent resources being injected as needed at runtime via the resolve mechanism.
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.
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) { |
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.
this naming somehow feels strange
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.
What would you name it?
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.
deletable
?
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.
Also problem here is that GarbageCollected is only applicatble for KubernetesDependentResource, so it is little smelly that it's on this layer.
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.
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); |
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.
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
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.
This isn't the case in the tests, though…
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.
Hmm where exactly?
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.
See 0a1a381
Kudos, SonarCloud Quality Gate passed! |
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.
LGTM
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.