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

`DependentResource` support for event sources where multiple resources of same type are handled for single primary

Open csviri opened this issue 3 years ago • 0 comments

In the following PR: https://github.com/java-operator-sdk/java-operator-sdk/pull/1169 we made sure that every resource event source can handle multiple secondary resources for a primary. A dependent resource however now represents a single resource on cluster. So in order to share a event source between more resource that are (the same type and) related to a single primary resources, we would need to have a discriminator function. So if a dependent resource receives from Set<R> getSecondaryResources() multiple resources this discriminator will select which one to handle from the set.

This is a relative simple but useful way to support this case.

csviri avatar Apr 22 '22 07:04 csviri