2023-04-24 02:05:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/argo1"
|
|
|
|
|
|
|
|
TARGETNS="argocd"
|
|
|
|
ORIGNS="$(kubectl config view --minify -o jsonpath='{..namespace}')"
|
|
|
|
|
2023-04-24 04:12:28 +00:00
|
|
|
all_subapps() {
|
|
|
|
(
|
|
|
|
for f in templates/*.yaml;do
|
|
|
|
sed -e '1!d' "$f"
|
|
|
|
done
|
|
|
|
) \
|
|
|
|
| grep -Eo '^#? *[{][{](- )? *if [(]index [.]Values "[^"]*"[)][.]enabled *( -)?[}][}]' \
|
|
|
|
| cut -d '"' -f 2
|
|
|
|
}
|
|
|
|
|
2023-04-24 02:05:13 +00:00
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
[ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace $TARGETNS
|
2023-04-24 04:12:28 +00:00
|
|
|
(
|
|
|
|
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
|
2023-04-24 02:05:13 +00:00
|
|
|
helm uninstall -n "$TARGETNS" argo1
|
|
|
|
bash delete-crds.sh
|
|
|
|
)
|
|
|
|
|
|
|
|
[ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace "$ORIGNS"
|