-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Allow explicit disable of autosync for applications #10070
Comments
Would love also to have that to help configure |
+1 |
This is really needed. |
What templating tool(s) need this? I believe Helm is powerful enough to handle the current disable mechanism. And the ApplicationSet controller isn't currently powerful enough to handle templating non-string fields (i.e. booleans like this one). So which templating tools are we solving this problem for? |
@alexec have the Workflows folks been happy with the decision to use |
Helm can indeed handle the part of |
Ahh. Basically you need the parent App to control the auto-sync on/off mechanism (whatever it might be). Is auto-syncing a parent app sufficient for your use case? Seems like there will be a moment of time where the child app's configuration is applied before the parent app's preference overrides it. Is that gap okay? |
This allows for an ApplicationSet generator to specify if AutoSync should be enabled on e.g. a Cluster basis. We are not able to control the structure of the yaml, e.g. |
As it's written, I'm not sure the proposal (or PR) would accomplish this, because the ApplicationSet controller is currently incapable of writing boolean values into a template. We could theoretically make this possible by either 1) modifying the ApplicationSet controller to write booleans or 2) making the But either way, I'm not sure we're properly solving the problem. If the problem is that we want the ApplicationSet controller to ensure that the |
Ah! I see that your use case is different from @maartengo. You're using ApplicationSets to set different sync options for different apps, not as an enforcement mechanism. I think the current PR almost gets you that. But we still gotta get the ApplicationSet controller to handle that field. |
We have a similar use case to @richardjennings-fc. We'd like to be able to conditionally disable auto sync on generated Applications from an ApplicationSet. In our case we have a race condition when removing one of the Appliaction created by the ApplicationSet, and the best solution we can imagine involves first disabling auto sync and then doing the proper deletion. We're going to try the Thank you!! |
@mrsimo does skip-reconcile work in your side? |
@debu99 we ended up not using it. We needed to prevent syncs while doing some cleaning up before destroying a whole environment (we saw edge cases when syncs got triggered while cleanup was happening), but with the skip-reconcile annotation, the We switched to deleting the Application (through the ApplicationSet) without cascade deletion, waiting until it's gone, and then doing everything in the cleaning script we were running anyway, including deleting the |
Another easy way to do this is just add a syncwindow to disallow specific applications. |
Thanks for the idea, but unfortunately we want to use it under applicationSet to disable one application without impact others |
Is there any update on this. I do use ApplicatonSet with an list-generator and I would like to disable/enable the automated sync via templating. I saw there are features like https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Controlling-Resource-Modification/ but this not totally addresses the issue. |
any news about this ? |
@crenshaw-dev The issue is that there is no way to enforce autosync off through gitops. If someone can enable autosync through the CLI/webui or through kubernetes there is nothing to turn off autosync again through gitops. This isn't strictly true, we used to enforce it by setting Error:
This means with server side diff it is no longer possible to control the disabled value of auto-sync. Example: Setting apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
argocd.argoproj.io/tracking-id: 'gitops:argoproj.io/Application:argocd/argocd'
finalizers:
- resources-finalizer.argocd.argoproj.io
name: argocd
namespace: argocd
spec:
destination:
name: in-cluster
namespace: argocd
project: default
revisionHistoryLimit: 0
source:
path: apps/argocd
repoURL: 'https://github.com/broersma-forslund/homelab.git'
targetRevision: HEAD
syncPolicy:
automated: null
syncOptions:
- FailOnSharedResource=true With server side diff I now have to generate my Apps like this: apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
argocd.argoproj.io/tracking-id: 'gitops:argoproj.io/Application:argocd/argocd'
finalizers:
- resources-finalizer.argocd.argoproj.io
name: argocd
namespace: argocd
spec:
destination:
name: in-cluster
namespace: argocd
project: default
revisionHistoryLimit: 0
source:
path: apps/argocd
repoURL: 'https://github.com/broersma-forslund/homelab.git'
targetRevision: HEAD
syncPolicy:
syncOptions:
- FailOnSharedResource=true After enabling auto-sync and self-heal through the webui the live manifest is: apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
argocd.argoproj.io/tracking-id: 'gitops:argoproj.io/Application:argocd/argocd'
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"argoproj.io/v1alpha1","kind":"Application","metadata":{"annotations":{"argocd.argoproj.io/tracking-id":"gitops:argoproj.io/Application:argocd/argocd"},"finalizers":["resources-finalizer.argocd.argoproj.io"],"name":"argocd","namespace":"argocd"},"spec":{"destination":{"name":"in-cluster","namespace":"argocd"},"project":"default","revisionHistoryLimit":0,"source":{"path":"apps/argocd","repoURL":"https://github.com/broersma-forslund/homelab.git","targetRevision":"HEAD"},"syncPolicy":{"automated":null,"syncOptions":["FailOnSharedResource=true"]}}}
creationTimestamp: '2023-10-29T16:22:55Z'
finalizers:
- resources-finalizer.argocd.argoproj.io
generation: 89678
name: argocd
namespace: argocd
resourceVersion: '103306926'
uid: 37986920-7741-4349-be6c-42bc97306d7b
spec:
destination:
name: in-cluster
namespace: argocd
project: default
revisionHistoryLimit: 0
source:
path: apps/argocd
repoURL: 'https://github.com/broersma-forslund/homelab.git'
targetRevision: HEAD
syncPolicy:
automated:
selfHeal: true
syncOptions:
- FailOnSharedResource=true And the diff after a hard refresh is empty, so auto-sync and auto-heal are not disabled. |
any updated? |
One workaround is to use |
I apparently never replied to this, so to answer your question @crenshaw-dev; yes that would fix my use case. So long as we have a way to re-sync the disabled state of the A short 'interruption' to the desired state is OK for me, because the user would have decided its OK to sync by enabling the automated option through the UI. |
in my case, i use applicationset to generate applications, so i want to set some condition that only some applications (maybe 50% of the applications generated by applicationset) can be automatically synced. |
Would also find conditional sync policy by cluster super useful in an ApplicationSet! In the meantime, progressive sync seems like a possible workaround. It did do exactly what I wanted - Big caveat, I have only tested it with a dummy app, as it is an alpha feature, and just enabling it on the This is the salient part of the test ApplicationSet spec
|
What is the current behavior
Configuring an application to have no
automated
property within thesyncPolicy
property will turn autosync off once. This will not however enforce that autosync is off. You can manually turn autosync on through the ArgoCD website and it will not be automatically disabled again.Expected behavior
There should be a way to explicitly turn autosync off. If a user then turns it on through the website, it should (depending on the autosync policy of the parent application) be automatically turned off again.
Perhaps an
enabled
flag would make sense here, instead of just not configuringautomated
which is the current way.Other info
Version: v2.4.7+81630e6
Helm: v3.8.1+g5cb9af4
The text was updated successfully, but these errors were encountered: