reliability improvements

fix some of the templating
make the uninstall script loop over all disableable apps and disable them
This commit is contained in:
James Andariese 2023-04-23 23:12:28 -05:00
parent 86b06f4196
commit 8e8325a86e
4 changed files with 24 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# {{ if (index .Values "haproxy-ingress").enabled -}} # {{ if (index .Values "haproxy-ingress").enabled }}
--- ---
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
@ -14,7 +14,8 @@ spec:
repoURL: https://haproxy-ingress.github.io/charts repoURL: https://haproxy-ingress.github.io/charts
targetRevision: 0.14.2 targetRevision: 0.14.2
helm: helm:
values: |-{{ (index .Values "haproxy-ingress").values | nindent 8 }} values: |-
{{ (index .Values "haproxy-ingress").values | nindent 8 }}
releaseName: haproxy-ingress releaseName: haproxy-ingress
destination: destination:
server: "https://kubernetes.default.svc" server: "https://kubernetes.default.svc"

View File

@ -1,4 +1,4 @@
# {{ if (index .Values "sealed-secrets").enabled -}} # {{ if (index .Values "sealed-secrets").enabled }}
--- ---
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application

View File

@ -1,4 +1,4 @@
{{ if (index .Values "secrets").enabled -}} # {{ if (index .Values "secrets").enabled }}
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
@ -30,4 +30,4 @@ spec:
duration: 5s duration: 5s
factor: 2 factor: 2
maxDuration: 3m0s maxDuration: 3m0s
{{- end }} # {{- end }}

View File

@ -5,12 +5,28 @@ cd "$(dirname "$0")/argo1"
TARGETNS="argocd" TARGETNS="argocd"
ORIGNS="$(kubectl config view --minify -o jsonpath='{..namespace}')" ORIGNS="$(kubectl config view --minify -o jsonpath='{..namespace}')"
all_subapps() {
(
for f in templates/*.yaml;do
sed -e '1!d' "$f"
done
) \
| grep -Eo '^#? *[{][{](- )? *if [(]index [.]Values "[^"]*"[)][.]enabled *( -)?[}][}]' \
| cut -d '"' -f 2
}
( (
set -e set -e
[ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace $TARGETNS [ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace $TARGETNS
argocd --core app set argo1 --helm-set sealed-secrets.enabled=false --helm-set secrets.enabled=false (
argocd --core app sync argo1 || argocd --core app wait --sync argo1 IFS=$'\n'
for app in $(all_subapps);do
argocd --core app set argo1 --helm-set "$app".enabled=false
done
)
sleep 10
argocd --core app wait --sync argo1
helm uninstall -n "$TARGETNS" argo1 helm uninstall -n "$TARGETNS" argo1
bash delete-crds.sh bash delete-crds.sh
) )