gitops-engine icon indicating copy to clipboard operation
gitops-engine copied to clipboard

Add annotation `argocd.argoproj.io/sync-options: Force=true`

Open jiwonaid opened this issue 3 years ago • 9 comments

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.

jiwonaid avatar May 30 '22 01:05 jiwonaid

Any progress with this enhancement?

jelical avatar Feb 01 '23 14:02 jelical

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.

jiwonaid avatar Feb 01 '23 15:02 jiwonaid

Is there a way in ArgoCD to do this currently?

sidharthramesh avatar Jun 18 '23 09:06 sidharthramesh

@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 avatar Oct 01 '23 19:10 thesuperzapper

@thesuperzapper I agree! I believe the open PR just needs some unit test work.

crenshaw-dev avatar Oct 01 '23 19:10 crenshaw-dev

@crenshaw-dev I assume you are talking about this PR: https://github.com/argoproj/gitops-engine/pull/526

thesuperzapper avatar Oct 01 '23 22:10 thesuperzapper

Correct

crenshaw-dev avatar Oct 01 '23 22:10 crenshaw-dev

What are the next steps on this PR?

csantanapr avatar Feb 29 '24 03:02 csantanapr

@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!

thesuperzapper avatar Feb 29 '24 04:02 thesuperzapper