You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While with kubernetes resources we do some nice assumptions about the resources, like
365
+
if there are multiple resources of the same type, we can select the target resource
366
+
that dependent resource manages based on the name and namespace of the desired resource;
367
+
or we can use a matcher based SSA in most of the cases if the resource is managed using SSA.
368
+
369
+
### Selecting the target resource
370
+
371
+
Unfortunately this is not true for external resources. So to make sure we are selecting
372
+
the target resources from an event source, we provide a [mechanism](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/AbstractExternalDependentResource.java#L114-L138) that helps with that logic.
373
+
Your POJO representing an external resource can implement [`ExternalResourceIDProvider`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/ExternalDependentIDProvider.java) :
374
+
375
+
```java
376
+
377
+
publicinterfaceExternalDependentIDProvider<T> {
378
+
379
+
TexternalResourceId();
380
+
}
381
+
```
382
+
383
+
That will provide an ID, what is used to check for equality for desired state and resources from event source caches.
384
+
Not that if some reason this mechanism does not suit for you, you can simply
By default, external resources are matched using [equality](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/AbstractExternalDependentResource.java#L88-L92).
391
+
So you can override equals of you POJO representing an external resource.
392
+
As an alternative you can always override the whole `match` method to completely customize matching.
393
+
358
394
## External State Tracking Dependent Resources
359
395
360
396
It is sometimes necessary for a controller to track external (i.e. non-Kubernetes) state to
0 commit comments