Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Sync Option DeleteResourceBeforeCreation #9163

Closed
in-cloud-opensource opened this issue Apr 21, 2022 · 1 comment · Fixed by #17866
Closed

New Sync Option DeleteResourceBeforeCreation #9163

in-cloud-opensource opened this issue Apr 21, 2022 · 1 comment · Fixed by #17866
Labels
enhancement New feature or request

Comments

@in-cloud-opensource
Copy link

in-cloud-opensource commented Apr 21, 2022

Summary

The proposal introduces a new sync option to control resource deletion before creation

Motivation

Working with K8 jobs can be a nightmare especially when updating the job command due to its immutable nature. When using jobs as resource hooks ArgoCD already supports the great feature of different hook deletion policies. In some cases, it might not be possible to run jobs as hooks and must be managed during the normal sync lifecycle. To ease this as it is already possible with hooks, we propose to introduce a new sync option DeleteResourceBeforeCreation that can be applied to all resources during the normal sync process.

We also considered using ttlSecondsAfterFinished to delete the job after a certain amount of time after job completion. But with active self-healing, ArgoCD will automatically recreate the deleted job, which does not work for us.

Furthermore, we also investigated the usage of sync option argocd.argoproj.io/sync-options: Replace=true, but doesn’t work since updating a job with replace only works when run with --force, which is currently only supported via the UI.

Proposal

Introduce a new sync option argocd.argoproj.io/sync-options: DeleteResourceBeforeCreation to control resource deletion.

apiVersion: batch/v1
kind: Job
metadata:  
  annotations:
    argocd.argoproj.io/sync-options: DeleteResourceBeforeCreation=true
...

Releated Issues

This enhancement is related to #5882

@in-cloud-opensource in-cloud-opensource added the enhancement New feature or request label Apr 21, 2022
@beatrausch
Copy link

Relates also to #7459

@in-cloud-opensource in-cloud-opensource changed the title Annotation delete-resource-before-creation New Sync Option DeleteResourceBeforeCreation Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants