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: remove managed-by label from terminating namespaces #854

Merged

Conversation

jaideepr97
Copy link
Collaborator

@jaideepr97 jaideepr97 commented Feb 9, 2023

Signed-off-by: Jaideep Rao jaideep.r97@gmail.com

What type of PR is this?

Uncomment only one /kind line, and delete the rest.
For example, > /kind bug would simply become: /kind bug

/kind bug

/kind chore
/kind cleanup
/kind failing-test
/kind enhancement
/kind documentation
/kind code-refactoring

What does this PR do / why we need it:
This PR removes the "managed-by" label from a previously managed now terminating namespace, which triggers the removal of this namespace from the argo-cd instance's cluster secret thus unblocking it from deploying resources to other managed namespaces
This seems like a cleaner approach than directly deleting the namespace from the cluster secret as we already have existing code paths to achieve this that could be triggered by removing the label from the terminating namespace - and while it is generally not a good idea to delete labels from namespaces (if not added by the operator) however, it maybe okay in this case since the namespace is scheduled for deletion anyway

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #853?

How to test changes / Special notes to the reviewer:
repeat steps documented in linked issue and confirm that app resources are in fact deployed to "John" namespace

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>
@@ -103,8 +103,13 @@ func (r *ReconcileArgoCD) reconcileRole(name string, policyRules []v1.PolicyRule

// create policy rules for each namespace
for _, namespace := range r.ManagedNamespaces.Items {
// Skip terminating namespaces.
// If encountering a terminating namespace remove managed-by label from it and skip reconciliation - This should trigger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should trigger or it will trigger?

Can we back this up by a test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jannfis
it will trigger
Added a test case, PTAL
(Only checking for synced state of app because the app likely runs privileged containers which will fail to come up on OCP and will stay in progressing/degraded state. Sync state anyway should confirm that the resources were at least deployed in the target namespace, which should be enough to address the original bug)

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>
Copy link
Collaborator

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jannfis jannfis merged commit 4bc7e00 into argoproj-labs:master Mar 1, 2023
ciiay pushed a commit to ciiay/argocd-operator that referenced this pull request Mar 20, 2023
…bs#854)

* remove managed-by label from terminating ns

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

* add e2e test

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>

---------

Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>
Signed-off-by: Yi Cai <yicai@redhat.com>
@jaideepr97 jaideepr97 deleted the remove-terminating-namespace branch February 14, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Managed namespace in terminating state blocks app resource deployment to other managed namespaces
2 participants