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

Consider deprecating `getSecondaryResource(Class,name)` method from Context

Open csviri opened this issue 3 years ago • 0 comments

(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:

  1. 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.
  2. We should move users to use just one event source per type, since it's more efficient.
  3. 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)
  4. 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:

  1. this still might be useful to distinguish or make it easier to find a cached resource.

csviri avatar May 25 '22 13:05 csviri