-
Notifications
You must be signed in to change notification settings - Fork 232
improve: possibility to provide id for external resource #3000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, if we could solve that, would be awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 <[email protected]>
Signed-off-by: Attila Mészáros <[email protected]>
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 <[email protected]>
|
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.