What are hook deletion policies?
Short answer
Hook deletion policies control when hook resources (like Jobs) are cleaned up: HookSucceeded (delete after success), HookFailed (delete after failure), or BeforeHookCreation (delete the previous hook instance before creating a new one).
Advertisement
AModel answer
Hook deletion policies control when hook resources (like Jobs) are cleaned up: HookSucceeded (delete after success), HookFailed (delete after failure), or BeforeHookCreation (delete the previous hook instance before creating a new one). They prevent accumulation of completed Job objects and manage reruns.
metadata:
annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook-delete-policy: HookSucceededReal-world example
A migration Job is deleted automatically after it succeeds so old completed Jobs don't pile up in the namespace.
Likely follow-ups
- Why use BeforeHookCreation? | What happens without a delete policy?
Related topics