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

disable autosync of all argocd apps #77

Merged
merged 2 commits into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions tks-cluster/remove-usercluster-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
templates:
- name: main
steps:
- - name: disableAutoSync
template: disableAutoSync

- - name: deleteIngressControllerApp
templateRef:
name: delete-apps
Expand Down Expand Up @@ -58,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

Expand Down Expand Up @@ -91,9 +103,6 @@ spec:
- name: app_name
value: "{{workflow.parameters.app_prefix}}-kubernetes-addons"

- - name: disableAutoSyncOfClusterApp
template: disableAutoSync

- - name: deleteClusterCR
template: deleteClusterCR
arguments:
Expand Down Expand Up @@ -133,18 +142,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"
Expand Down