Troubleshooting common issues
Problem: Issue with argo-cd app stuck in syncing state indefinetly.
Solution:
There is a resource which has the following annotations:
jsonCopy code"helm.sh/hook": "pre-install,pre-upgrade",
"helm.sh/hook-delete-policy": "before-hook-creation",
"helm.sh/hook-weight": "0"
The annotation "
helm.sh/hook-delete-policy
": "before-hook-creation"
is causing the actual issue. It will attempt to delete the secret before it gets triggered. This means it will try to look for the resource secret and delete it before creating it again.
However, in the case of my Argo CD app, it is already deleted when I delete the Argo CD app. When I recreate the app, there is no secret, but it will try to delete the non-existing resource, resulting in it getting stuck in the pending state forever.
To overcome this issue, I replaced the above Helm hooks annotations with the following Argo CD annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook-delete-policy: before-hook-creation
argocd.argoproj.io/sync-wave: "-1"
This helped me to fix the problem.