cyclops
cyclops copied to clipboard
Handle two Modules owning the same resource
Is your feature request related to a problem? Please describe. Each Module will create its own set of resources. When two Modules create the same resource, one of the Modules will report that it has all the resources it should have, while the other one will just say it's empty and that it misses the resource.
Describe the solution you'd like If a new Module is created and it wants to create a resource that is already owned by another Module, it should report on the UI that there is a clash in resources. I wouldn't go with overriding other Modules resource ownership
Additional context
Resource ownership is defined on each resource with the label cyclops.module. For example, Module demo created a Deployment app, and the app Deployment will have the label cyclops.module: demo
I can work on this issue
Thanks @hanshal101!
Hey, @petar-cvit, so my approach over here is to make a checkpoint before creating a module to check the resource already exists or not. If true, then return error; otherwise, pass.
What you think of this? Also, I'm having a hard time finding the Create Logic for Modules, the last code I reached was 😅: https://github.com/cyclops-ui/cyclops/blob/f7f36919635cd7344f2ff6c50dea58509bd0de63/cyclops-ctrl/api/v1alpha1/client/modules.go#L53-L65
Hey @hanshal101. K8s API will take care of duplicate Modules, so we don't have to worry about that. The problem is that two Modules can try the create the "same" object.
For example:
- Module A creates a Deployment called
example - Module B want to create the same Deployment
exampleand overrides thecyclops.modulelabel and takes over the Deployment
You will need to find a mechanism to track shared ownership of resources when creating/updating children resources
Okay correct me if I am wrong so before creating any module, we need to make sure the current deployment
label: cyclops.module=example should check if any existing deployment has the same label , if yes the stop and return err.
Yes, so each time you want to create new resources from a Module, you have to check their cyclops.module label. If it's set to something else then the Module name, you should report an error
@petar-cvit want to work on this,can you assign it to me.
New Quest!
A new Quest has been launched in @cyclops-ui’s repo. Merge a PR that solves this issue to loot the Quest and earn your reward.
Some loot has been stashed in this issue to reward the solver!
🗡 Comment @quest-bot embark to check-in for this Quest and start solving the issue. Other solvers will be notified!
⚔️ When you submit a PR, comment @quest-bot loot #163 to link your PR to this Quest.
Questions? Check out the docs.
Hey if this issue is still open then I would love to work on this issue please
Sure thing @chetak123! Let me know if you need any help