Skip to content
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

Fix item crud when changing clusters #1707

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

joaquimrocha
Copy link
Collaborator

This issue fixes #1660 by making the cluster name as part of each resource instance and using it for the operations (+ something similar for the resource creation).

fixes #1660

How to test:

  • Create/edit/delete a resource (example, a ConfigMap); during the grace period, move to a different cluster and wait for the resource to be created/edited/deleted: verify that the operation happened on the original cluster and not in the one you moved to

Due to how the cluster actions are implemented, the actual functions,
like update/delete, are only called at the end of the grace period.
Since that is also when the cluster name would be gathered, then it
could happen that the user changed clusters, and thus this could lead
to updating/deleting a resource in a cluster that is different from
the intended one (if a similar resource exists).

This patch solves this by adding the cluster name to which a resource
belongs as an inner member of that resource instance. This cluster name
is then used for the mentioned operations, hence guaranteeing that the
operations always happen for the same cluster that the item belongs to.

Signed-off-by: Joaquim Rocha <[email protected]>
When using the creation dialog to create a resource, due to the fact
that the creation function only checked the current cluster after the
grace period ends, it may happen that the user changed to a different
cluster and thus the change would be applied to a different cluster
from what was desired.

This patch fixes that by getting the cluster right from the moment the
user clicks Apply, so even if clusters are changed, the resources are
applied on the intended cluster.

Signed-off-by: Joaquim Rocha <[email protected]>
@joaquimrocha joaquimrocha requested a review from illume February 9, 2024 16:34
@joaquimrocha
Copy link
Collaborator Author

@farodin91 , can you test this one too?

@farodin91
Copy link
Contributor

@joaquimrocha I will try to check it on monday.

@farodin91
Copy link
Contributor

@joaquimrocha Works fine.

@joaquimrocha joaquimrocha merged commit 48b1801 into main Feb 19, 2024
9 checks passed
@joaquimrocha joaquimrocha deleted the fix-item-crud-when-changing-clusters branch February 19, 2024 12:00
@joaquimrocha joaquimrocha added this to the v0.23.0 milestone Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Bug: Deletion in the wrong cluster through delay
2 participants