java-operator-sdk
java-operator-sdk copied to clipboard
Consider deprecating `getSecondaryResource(Class,name)` method from Context
(And removing in next major release.)
https://github.com/java-operator-sdk/java-operator-sdk/blob/58d2ea32cad4144aa63e3836e616a23c2fa911f0/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Context.java#L19-L21
Pros:
- we anyway have now
<T> Set<T> getSecondaryResources(Class<T> expectedType);which return all the resource from all the related event sources of that type. - We should move users to use just one event source per type, since it's more efficient.
- The event sources and resource cached are now tightly coupled, but this is not necessarily a good thing, might event change in the future. So ideally this interface should not know about the event sources and their names (what we might not even need then in the future)
- We could remove the quite complex code related to this logic:
https://github.com/java-operator-sdk/java-operator-sdk/blob/58d2ea32cad4144aa63e3836e616a23c2fa911f0/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/EventSources.java#L100-L140
Const:
- this still might be useful to distinguish or make it easier to find a cached resource.