fix: remove legacy argocd resources properly

This commit is contained in:
Stefan Reimer 2024-04-11 14:42:15 +01:00
parent 14205a8dbc
commit 6ad84cf43d

View File

@ -13,13 +13,6 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "Checking that all pods in kube-system are running ..."
waitSystemPodsRunning
### v1.28
# - remove old argocd app, all resources will be taken over by argo.argo-cd
argo_used && kubectl patch app argocd -n argocd \
--type json \
--patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
kubectl delete app argocd -n argocd || true
argo_used && disable_argo
#all_nodes_upgrade ""
@ -30,6 +23,19 @@ control_plane_upgrade kubeadm_upgrade
# shellcheck disable=SC2015
#argo_used && kubectl edit app kubezero -n argocd || kubectl edit cm kubezero-values -n kube-system
### v1.28
# - remove old argocd app, all resources will be taken over by argo.argo-cd
argo_used && rc=$? || rc=$?
if [ $rc -eq 0 ]; then
kubectl patch app argocd -n argocd \
--type json \
--patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
kubectl delete app argocd -n argocd || true
# remove legacy argocd app resources, but NOT kubezero-git-sync nor the appproject
kubectl api-resources --verbs=list --namespaced -o name | grep -ve 'app.*argoproj' | xargs -n 1 kubectl delete --ignore-not-found -l argocd.argoproj.io/instance=argocd -n argocd
fi
# upgrade modules
control_plane_upgrade "apply_network, apply_addons, apply_storage, apply_operators"