-
Notifications
You must be signed in to change notification settings - Fork 218
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
Question: Primary to DR many-to-one & many-to-many relationships possible? #2159
Comments
Hi, pls check: https://javaoperatorsdk.io/docs/features#managing-relation-between-primary-and-secondary-resources There are samples how to do many-to-many relations, if you want to access those with
|
Thank you for your quick answer! Do I understand this correctly: |
In short no, you can update the resource. This sample show to use is as read only, what we saw in practice usually,. Thus there is a ConfigMap that serves as input for multiple custom resources (share some paramters). But it is possible to update it normally, that should work. But then multiple resources might compete for that. In your case the |
I did some testing and it actually works, thank you for your help! There is still one problem left though: The reconcile method is only called for one UserGroup, not all of them. Because of this only this "primary" UserGroup can update its status. Is there any way to solve this issue? |
Glad to hear it works!
How is the |
User is the DR, UserGroup the primary resource |
Hmm, but where That is a bit tricky situation, it should be the case that User have 2 owner references, for each |
alice comes from a 3rd party source, but that shouldn't relevant Yes User has 2 owner references due to my kotlin code here (desiredResources in my UserDR extends BulkDependentResource:
|
Ok, thx, it seems this could be improved: Currently only the first owner reference is taken into account. What you can do is to fix it in your code is to implement |
Just some rational why was not like this for now: The owner references does not have always the same type, thus your use case. And the target type is not available when the mapper is created. But IMHO is reasonable to have this behavior as default. And if does not fit ones use case still can be changed as show above. |
Thanks a lot, it works now! |
I have a usecase, where I need to create, update and delete Resources, depending on multiple primary resources.
Here is a little example:
My primary custom resource is UserGroup. Let's say I have 2 of those:
From this I want to generate User custom resources. If a User in both the read-group and the write-group, he should get both permissions:
Changes like updates and deletion on the UserGroup should also trigger updates on the User
I wanted to avoid using the KubernetesClient directly because just specifying a simple desired state like with AbstractDependentResource::desired seems to be less complicated.
Is something like this possible in java-operator-sdk?
The text was updated successfully, but these errors were encountered: