Created
April 11, 2023 18:08
-
-
Save rjchicago/bf13a77cc8dd9d63a69ef529977a1f15 to your computer and use it in GitHub Desktop.
Reset ArgoCD Application Finalizers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In switching Git repositories, I found you must delete the ArgoCD ApplicationSets and | |
# Applications in order to allow ArgoCD to recreate. However, deleting the resources can | |
# hang due to finalizers. Run the below script to reset the ArgoCD Application finalizers: | |
# get argocd applications by name, one per row | |
APPS=$(kubectl get -n ${NAMESPACE:-argocd} applications.argoproj.io -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{"\n"}{end}') | |
# loop through and reset each application's finalizers | |
while read -r APP; do | |
kubectl patch -n ${NAMESPACE:-argocd} applications.argoproj.io/$APP -p '{"metadata":{"finalizers":[]}}' --type=merge | |
done <<< $APPS | |
# verify sync/health status | |
kubectl get applications.argoproj.io -n argocd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment