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

Support Bulk read-only dependent resources

Open tomdw opened this issue 1 year ago • 3 comments

On https://javaoperatorsdk.io/docs/dependent-resources#read-only-dependent-resources-vs-event-source there is a section on read only dependent resources.

However, as soon as it is more than 1 dingle dependent resource, i.e. a bulk of dependent resources of the same type, then there is not possibility to make it a read-only resource.

Support for bulk resources through BulkDependentResource assumes that creating and updating those resources is needed. For a read-only dependent resource this is not the case.

The scenario is to make a reconciler/operator also listen to additional dependent resources that are not created by the operator itself. We could use an event source only, but the dependent resources would make it easier.

tomdw avatar Feb 05 '24 08:02 tomdw

Hi @tomdw , thx for the issue, could you describe the use case more in depth? To be hones I see a little value in this. Around read-only dependents was already a dilemma. So could describe please, where/how exactly this would help in you case?

csviri avatar Feb 05 '24 09:02 csviri

@csviri It has the same value as the read-only dependents documented and advised on the link I provided above. The only things this request adds is to also support this for a one-to-many relationship between the primary and the dependents. It is another operator or process or manual action that creates the dependent resources and the primary needs to watch these and react accordingly.

Example: update its status based on the information from the many dependent resources + when the primary is deleted also cleanup the dependents.

tomdw avatar Feb 05 '24 09:02 tomdw

I see, the only real value I see in this:

  1. as mentioned in the docs, there can be conditions (well mostly ready condition) on a read only dependent - in combination with depends on relation.
  2. you can use this API from the condition: https://github.com/operator-framework/java-operator-sdk/blob/1fc9e3ebac7533be444abe1dcf12f396b8fcc0b6/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/BulkDependentResource.java#L41-L41

Otherwise in the background will happen exactly the same as when having a (non-bulk) read only dependent / informer. So I agree that even this might have an added value, even if that is not that large.

csviri avatar Feb 05 '24 10:02 csviri