gitops-engine
                                
                                
                                
                                    gitops-engine copied to clipboard
                            
                            
                            
                        Add annotation `argocd.argoproj.io/sync-options: Force=true`
Summary
This issue is about the need for the new annotation argocd.argoproj.io/sync-options: Force=true, which is needed for the use case like the job resources that should run every time when syncing.
Goals & Proposal
Could we implement the new annotation feature on this repo?
Based on kubectl replace --help, --force is needed to delete and then re-create the resources.
~  kubectl replace --help
  
  # Force replace, delete and then re-create the resource
  kubectl replace --force -f ./pod.json
  
Currently, there is nothing like argocd.argoproj.io/sync-options: Force=true.
It seems like argocd.argoproj.io/sync-options: Replace=true runs on this library.
https://github.com/argoproj/gitops-engine/blob/b855894da06d5bcb2f26ebd3aebd92f1591dbe0a/pkg/sync/sync_context.go#L176-L180
Releated Issues
There are some related issues at argo-cd repo. Please take a look. https://github.com/argoproj/argo-cd/issues/5882 https://github.com/argoproj/argo-cd/issues/7459 https://github.com/argoproj/argo-cd/issues/9163
Thank you for reading.
Any progress with this enhancement?
Hi @jelical, I am not sure argocd's current status, and not working on this.
Anyone who would like to push this forward can take this.
Thank you.
Is there a way in ArgoCD to do this currently?
@crenshaw-dev @gdsoumya @alexec I think this is an absolutely critical feature, so would appreciate your feedback.
Currently, ArgoCD doesn't have a way to use kubectl apply --force or kubectl replace --force, and this is required to update some common types of Kubernetes resources, like Jobs and CronJobs and even bare Pods.
The solution posed here is very elegant, as it allows users to specifically annotate argocd.argoproj.io/sync-options: Replace=true,Force=true on resources that they know can't be updated without being deleted first.
@thesuperzapper I agree! I believe the open PR just needs some unit test work.
@crenshaw-dev I assume you are talking about this PR: https://github.com/argoproj/gitops-engine/pull/526
Correct
What are the next steps on this PR?
@crenshaw-dev it really looks like https://github.com/argoproj/gitops-engine/pull/526 just needs a final review so it can be merged, this would be a great feature for the next ArgoCD version!