improve: possibility to provide id for external resource#3000
improve: possibility to provide id for external resource#3000
Conversation
docs/content/en/docs/documentation/dependent-resource-and-workflows/dependent-resources.md
Outdated
Show resolved
Hide resolved
| [`targetSecondaryResourceID`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/AbstractExternalDependentResource.java#L138) | ||
| for external resources. See below the related ID handling | ||
| - If the approach from above doesn't fit your needs, you can override the target resource selection mechanism by overriding | ||
| `selectTargetSecondaryResource` for both [`KubernetesDependentResource`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/KubernetesDependentResource.java#L282) |
There was a problem hiding this comment.
Noting also that we should propably look into how to automate this with some kind of annotation comments in code to track correct line numbers.
There was a problem hiding this comment.
yes, if we could solve that, would be awesome.
There was a problem hiding this comment.
@csviri but this link still needs to be fixed or not?
docs/content/en/docs/documentation/dependent-resource-and-workflows/dependent-resources.md
Show resolved
Hide resolved
…der to avoid calling desired state Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
ef17ff9 to
ffc9e85
Compare
|
@metacosm I would like to merge this, we can have the desired caching as a followup pr on |
Signed-off-by: Chris Laprun <metacosm@gmail.com>
|
Reviewing this, I'm not sure I like the current design of putting the provider on the external resource class… I think it might be more appropriate to put it on the related dependent resource implementation since this is where the logic for this should be, imo. It doesn't feel right to put JOSDK-related logic on the external resource class, especially considering that maybe that class is not modifiable (if it's coming from a 3rd party library, for example). It also makes sense to gather the resource identification logic on the dependent resource implementation, imo. |
Yes, I was also thinking about that. Maybe we could generalize the WDYT? But those are not necessarily contradicting nor we have to choose, we can have the (renamed to ResourceIDMapper ) |
|
So what I would do is to merge this and #3007 to next, but iterate over it for 5.2 to achieve what you also proposed. |
|
I think Chris has a point. So why it would be worth merging this now to next and then changing it later? |
|
Should the branch be deleted? |
PR introduces similar mechanism for external resource as for KubernetesDependetResource to easily override a method to provide an ID if user want't to avoid computing desired states multiple times.
Also improves the docs with pointers where we explain how to avoid calling desired multiple times.