-
Notifications
You must be signed in to change notification settings - Fork 218
Remove ResourceDiscriminators
(legacy approach)
#2253
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
Comments
The only case with is not handled now elegantly is the read-only dependent resource since that does not have the desired state by default. There are multiple choices regarding this:
|
I think we should keep them for optimization purposes as well. If the desired state is costly to compute and there are better ways to decided which secondary resource needs to be used, I think it still makes sense to use a discriminator even if it shouldn't be needed in most cases. That said, we could indeed tell people to override |
exactly, basically resource discriminator puts nothing on table now, as we discussed before the only reason to create was to have a class representing the concept explicitly, so it is settable explicitly on a resource. But it's API is basically just the
On the other hand desired needs to be always computed, except in the read-only (what is already kinda exotic case https://javaoperatorsdk.io/docs/dependent-resources#read-only-dependent-resources-vs-event-source ) But will examine the problem more in depth. |
Yes but if it's costly to compute, we should try to avoid computing it several times… maybe we should record the computed desired state(s) in the Context so that they are available for downstream usage once they have been computed once? |
yes definitelly, that is something will be done even if the discriminators are not removed. |
After using JOSDK for quite some time now, I think we only need discriminators for dependents because dependents currently have no identifiers. This is why @csviri proposes to evaluate the resource that the desired method returns. To overcome this problem of missing identifier, I've added the following method to all of my dependent classes You could force users to define the identifier upfront (e.g. by an abstract method
|
With this PR: #2252
we can handle this quite elegantly without the resource discriminators, is there are use case (also for external resources) when we need this former approach anymore? If we cannot think we should consider removing this for v5
The text was updated successfully, but these errors were encountered: