java-operator-sdk
java-operator-sdk copied to clipboard
`DependentResource` support for event sources where multiple resources of same type are handled for single primary
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.