From 0bdb4d78a6aae455c9066f63415a858974ea65c2 Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Tue, 5 Apr 2022 17:59:13 +0900 Subject: [PATCH 1/2] disable auto-sync of all argocd apps --- tks-cluster/remove-usercluster-wftpl.yaml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tks-cluster/remove-usercluster-wftpl.yaml b/tks-cluster/remove-usercluster-wftpl.yaml index 55e849a7..0af73fec 100644 --- a/tks-cluster/remove-usercluster-wftpl.yaml +++ b/tks-cluster/remove-usercluster-wftpl.yaml @@ -31,6 +31,9 @@ spec: templates: - name: main steps: + - - name: disableAutoSync + template: disableAutoSync + - - name: deleteIngressControllerApp templateRef: name: delete-apps @@ -91,9 +94,6 @@ spec: - name: app_name value: "{{workflow.parameters.app_prefix}}-kubernetes-addons" - - - name: disableAutoSyncOfClusterApp - template: disableAutoSync - - - name: deleteClusterCR template: deleteClusterCR arguments: @@ -133,18 +133,16 @@ spec: - /bin/bash - '-c' - | - APP_NAME="cluster-api-aws" - if [[ -n "{{workflow.parameters.app_prefix}}" ]]; then - APP_NAME="{{workflow.parameters.app_prefix}}-cluster-api-aws" - fi - # Login to Argo CD server ./argocd login $ARGO_SERVER --plaintext --insecure --username $ARGO_USERNAME \ --password $ARGO_PASSWORD - # Disable auto-sync - echo "Disabling auto-sync of [$APP_NAME]' app.." - ./argocd app set $APP_NAME --sync-policy none + app_list=$(./argocd app list --output name | grep {{workflow.parameters.app_prefix}}) + echo -e "App list:\n $app_list" + if [[ $? -eq 0 && -n $app_list ]]; then + # Disable auto-sync + echo "$app_list" | xargs -I '{}' ./argocd app set '{}' --sync-policy none + fi envFrom: - secretRef: name: "decapod-argocd-config" From 0159fffc3eb0cee3d31819a4de8147df568200d2 Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Wed, 6 Apr 2022 14:05:49 +0900 Subject: [PATCH 2/2] delete kubed app --- tks-cluster/remove-usercluster-wftpl.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tks-cluster/remove-usercluster-wftpl.yaml b/tks-cluster/remove-usercluster-wftpl.yaml index 0af73fec..668ddf64 100644 --- a/tks-cluster/remove-usercluster-wftpl.yaml +++ b/tks-cluster/remove-usercluster-wftpl.yaml @@ -61,6 +61,15 @@ spec: - name: app_name value: "{{workflow.parameters.app_prefix}}-metrics-server" + - - name: deleteKubedApp + templateRef: + name: delete-apps + template: DeleteAppsByName + arguments: + parameters: + - name: app_name + value: "{{workflow.parameters.app_prefix}}-kubed" + - - name: cleanupPVCs template: cleanupPVCs