java-operator-sdk icon indicating copy to clipboard operation
java-operator-sdk copied to clipboard

[Feature Request] Add type to result of condition evaluation

Open btlem opened this issue 1 year ago • 3 comments

Summary

The current Workflow implementation allows for the registration of dependent ready conditions, which produces a binary result. However, the specific business logic for what "ready" means may contain information that would be useful to propagate to the status of the primary, such as "Conditions".

Proposal (for brainstorming)

Include an additional return type in the signature of the isMet method, which will allow for storing additional information related to the computation of whether the dependent is ready or not.

Example Scenario

Dependent Resource -> Ingress Is Ready Condition -> Are endpoints externally accessible (DNS record etc), returns status of each Primary Status Condition -> Are endpoints ready, if not which are pending

btlem avatar Jun 03 '24 23:06 btlem

This sounds, useful yes!

Note that you can now add arbitrary information to the context and use it later when creating the status here:

https://github.com/operator-framework/java-operator-sdk/blob/7e2f3aecece65a9ef1a5999e2785888ae458837b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/dependent/managed/ManagedDependentResourceContext.java#L26-L41

csviri avatar Jun 04 '24 07:06 csviri

@btlem let us know if the associated PR addresses your use case.

metacosm avatar Jun 05 '24 14:06 metacosm

@metacosm Read through the PR and it looks good to me. I agree with the comment that it is general and could be applied to more conditions, though my main use-case is covered here, so this part is mainly nice-to-have for me

Thanks both (+ @csviri ) for the quick action on this!

btlem avatar Jun 11 '24 21:06 btlem