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

feat: add prompting to confirm remove of cluster resources #10319

Merged
merged 1 commit into from Aug 19, 2022

Conversation

my-git9
Copy link
Member

@my-git9 my-git9 commented Aug 13, 2022

Add prompting to confirm remove of cluster resources

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@my-git9
Copy link
Member Author

my-git9 commented Aug 13, 2022

The test result:

$ ./argocd cluster rm test
Are you sure you want to remove 'test' and all its resources? [y/n] y
Cluster 'test' removed
INFO[0002] ClusterRoleBinding "argocd-manager-role-binding" deleted
INFO[0003] ClusterRole "argocd-manager-role" deleted
INFO[0003] ServiceAccount "argocd-manager" deleted
$ ./argocd cluster rm test -y
Cluster 'test' removed
INFO[0000] ClusterRoleBinding "argocd-manager-role-binding" deleted
INFO[0001] ClusterRole "argocd-manager-role" deleted
INFO[0001] ServiceAccount "argocd-manager" deleted
$ ./argocd cluster rm test local
Are you sure you want to remove 'test' and all its resources? [y/n/A] where 'A' is to remove all specified apps and their resources without prompting A
Cluster 'test' removed
INFO[0002] ClusterRoleBinding "argocd-manager-role-binding" deleted
INFO[0003] ClusterRole "argocd-manager-role" deleted
INFO[0003] ServiceAccount "argocd-manager" deleted
Cluster 'local' removed
INFO[0003] ClusterRoleBinding "argocd-manager-role-binding" deleted
INFO[0004] ClusterRole "argocd-manager-role" deleted
INFO[0004] ServiceAccount "argocd-manager" deleted

@codecov
Copy link

codecov bot commented Aug 13, 2022

Codecov Report

Merging #10319 (b437890) into master (5181bc1) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master   #10319      +/-   ##
==========================================
- Coverage   45.92%   45.89%   -0.04%     
==========================================
  Files         229      229              
  Lines       28278    28299      +21     
==========================================
  Hits        12987    12987              
- Misses      13518    13539      +21     
  Partials     1773     1773              
Impacted Files Coverage Δ
cmd/argocd/commands/cluster.go 8.17% <0.00%> (-0.73%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@my-git9 my-git9 force-pushed the clusterremove branch 2 times, most recently from f225498 to fe88da4 Compare August 14, 2022 03:37
@my-git9
Copy link
Member Author

my-git9 commented Aug 16, 2022

/cc @crenshaw-dev Hi, can you help me review this PR? Thanks

Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

I'm actually unfamiliar with the effects of deleting a cluster. Does it actually delete all the apps and their resources if they're deployed to that cluster? Or does it just cause those apps to go into "unknown" sync status and health?

@my-git9
Copy link
Member Author

my-git9 commented Aug 18, 2022

I'm actually unfamiliar with the effects of deleting a cluster. Does it actually delete all the apps and their resources if they're deployed to that cluster? Or does it just cause those apps to go into "unknown" sync status and health?

I tested it, it cause those apps to go into "unknown" sync status and health:

$ argocd cluster rm https://10.29.12.61:16443
Cluster 'https://10.29.12.61:16443' removed
# this will hang
$ argocd app sync guest2
TIMESTAMP                  GROUP        KIND   NAMESPACE                  NAME    STATUS   HEALTH        HOOK  MESSAGE
2022-08-18T22:51:17+08:00            Service     default          guestbook-ui    Synced  Healthy
2022-08-18T22:51:17+08:00   apps  Deployment     default          guestbook-ui    Synced  Healthy
^C
# the apps go into "unknown" sync status and health
$ argocd app list
NAME            CLUSTER                         NAMESPACE  PROJECT  STATUS     HEALTH       SYNCPOLICY  CONDITIONS        REPO                                                  PATH            TARGET
guest2          https://10.29.12.61:16443       default    default  Unknown    Unknown      <none>      InvalidSpecError  https://gitlab.daocloud.cn/xin.li/argocd-example.git  guestbook

cmd/argocd/commands/cluster.go Outdated Show resolved Hide resolved
cmd/argocd/commands/cluster.go Outdated Show resolved Hide resolved
Signed-off-by: xin.li <xin.li@daocloud.io>
Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

lgtm!

@crenshaw-dev crenshaw-dev merged commit 2fb2c23 into argoproj:master Aug 19, 2022
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.

None yet

2 participants