Resources are created during dry-run when using Force=true,Replace=true
sync options #623
Description
If resources have the argocd.argoproj.io/sync-options: Force=true,Replace=true
annotation, they are recreated twice:
- when Argo CD performs dry-run
- when Argo CD performs the actual sync
This behavior can be observed when using multiple Jobs with the argocd.argoproj.io/sync-options: Force=true,Replace=true
annotation and different sync waves. All Jobs are created immediately on the cluster during the dry-run phase and then recreated one-by-one as their respective sync wave is processed by Argo CD.
More information about using replace with dry-run and force options can be found in kubernetes/kubectl#1222. kubectl
is used as library in gitops-engine
but only Run()
method is called. However, the fix in kubernetes/kubernetes#110326 updated the Validate()
method.
I believe that the force option should not be set to true when performing a dry-run replace operation. This would avoid unnecessary resource recreation and make it usable with sync waves.