argo-cd: Unable to disable auto-sync

Argo CD version:

Describe the bug

With app-of-apps pattern, when syncPolicy of a child application changes from “automated” to empty, Argo does not spot the difference. The child application remains in auto-sync mode, although it’s desired manifest in the parent app changes

To Reproduce

  • Create an application, which creates another application with auto-sync policy
  syncPolicy:
    automated: {}
  • After everything is synchronized change policy to
  syncPolicy: {}

Expected behavior

Synchronization policy of the child application changes. However, it remains auto-sync. No Diff is spotted in spite of different live and desired manifests

Screenshots

With these live and desired manifests, the Diff tab is empty

image

image

Version

Taken from UI

v1.6.1+159674e

Note: we also spotted #3815. Seems treating of default or boolean values of syncPolicy has changed in v1.6

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 5
  • Comments: 23 (2 by maintainers)

Most upvoted comments

Also check if you have an ApplicatoinSet that manages your Applications. In this case all changes to Application will be instantly undone, no matter what they were made with (UI/argocd cli/CRD)

I also ran into this issue, which is disconcerting when trying to temporarily adjust settings, perform manual tests, rollbacks, or whatever else. Argo’s UI seems to allow disabling regular apps, but when using an ApplicationSet (in my case, to generate ephemeral preview environments based on PRs) I’m unable to turn off the auto sync.

I’m not sure how to recommend a resolution, but this should certainly be addressed in some fashion. I think it’s important to be able to disable sync, healing, etc on the apps created by an AppSet.

Update: For my problem (and i figure it might resolve the OPs problem as well) the issue was that in my app-of-apps pattern, the root-application was configured with self-heal=true, causing changes to the child-apps to be “healed” even though the child apps had a different (or no) sync-policy configured. So now my setup is: root-app: syncPolicy: automated # so new apps are auto-detected and deployed prune: true # so removed apps get deleted and selfHeal: false # so changes to child-apps (e.g. via the UI) do not trigger an auto sync

I hope this helps someone out there as well!

I actually found out that setting this field to the null equivalent disables auto sync

  # Sync policy
  syncPolicy:
    automated:
image

We are also experiencing this issue, what is the current status on this?

kubectl -n <namespace> patch --type='merge' application <app-name> -p "{\"spec\":{\"syncPolicy\":null}}"

@sadovnikov Would you mind to re-open this issue ?

@illegalnumbers yes, this will allow folks to exclude fields from ApplicationSet’s regular updates: https://github.com/argoproj/argo-cd/pull/14743

I want to override sync policy from CLI and I also fail miserably. I tried the approach proposed by @adrian-sturm, but with no result. I tried disabling syncing at all, also with no result. From UI the situation is the same. Additionally, I don’t get any error messages, argo just keeps bringing back the original configuration.

  1. Parent application yaml and original status:

    destination:                                                                 
      namespace: krowa                                                           
      server: https://kubernetes.default.svc                                     
    project: default                                                             
    source:                                                                      
      helm:                                                                      
        valueFiles:                                                              
        - environments/dev.yaml                                                  
      path: argocd/krowa-apps                                                    
      repoURL: <redacted>                                                        
      targetRevision: HEAD                                                       
    syncPolicy:                                                                  
      automated:                                                                 
        prune: true                                                              
        selfHeal: true                                                           
    
    $ argocd app get krowa-parent
    Name:               argo/krowa-parent
    Project:            default
    Server:             https://kubernetes.default.svc
    Namespace:          krowa
    URL:                <redacted>
    Repo:               <redacted>
    Target:             HEAD
    Path:               argocd/krowa-apps
    Helm Values:        environments/dev.yaml
    SyncWindow:         Sync Allowed
    Sync Policy:        Automated (Prune)
    Sync Status:        Synced to HEAD (5519559)
    Health Status:      Healthy
    
    GROUP        KIND         NAMESPACE     NAME             STATUS     HEALTH  HOOK  MESSAGE
                 Namespace    krowa         krowa            Succeeded  Synced        namespace/krowa unchanged
    argoproj.io  Application  argo          child-app        Synced                   application.argoproj.io/child-app configured
                 Namespace                  krowa            Synced
    
  2. I edited parent app and I commented out whole syncPolicy section:

    $ argocd app edit krowa-parent
    
     # Please edit the object below. Lines beginning with a '#' will be ignored,
     # and an empty file will abort the edit. If an error occurs while saving this file will be
     # reopened with the relevant failures."
    
     destination:
       namespace: krowa
       server: https://kubernetes.default.svc
     project: default
     source:
       helm:
         valueFiles:
         - environments/dev.yaml
       path: argocd/krowa-apps
       repoURL: <redacted>
       targetRevision: HEAD
    # syncPolicy:
    #   automated:
    #     prune: true
    #     selfHeal: true
    
  3. Check app once again

    $ argocd app get krowa-parent
    Name:               argo/krowa-parent
    Project:            default
    Server:             https://kubernetes.default.svc
    Namespace:          krowa
    URL:                <redacted>
    Repo:               <redacted>
    Target:             HEAD
    Path:               argocd/krowa-apps
    Helm Values:        environments/dev.yaml
    SyncWindow:         Sync Allowed
    Sync Policy:        Automated (Prune)
    Sync Status:        Synced to HEAD (5519559)
    Health Status:      Healthy
    
    GROUP        KIND         NAMESPACE     NAME             STATUS     HEALTH  HOOK  MESSAGE
                 Namespace    krowa         krowa            Succeeded  Synced        namespace/krowa unchanged
    argoproj.io  Application  argo          child-app        Synced                   application.argoproj.io/child-app configured
                 Namespace                  krowa            Synced
    
    
  4. Running argocd app set krowa-parent --sync-policy="none" has no effect.

  5. Changes in UI are also immediately brought back to the original settings.

  6. Argo CD Server version

    {
    "Version": "v2.6.3+e05298b",
    "BuildDate": "2023-02-27T14:40:19Z",
    "GitCommit": "e05298b9c6ab8610104271fa8491f019fee3c587",
    "GitTreeState": "clean",
    "GoVersion": "go1.18.10",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KustomizeVersion": "v4.5.7 2022-08-02T16:35:54Z",
    "HelmVersion": "v3.10.3+g835b733",
    "KubectlVersion": "v0.24.2",
    "JsonnetVersion": "v0.19.1"
    }
    

I’d really appreciate some help 😃

I’m facing the similar problem that I cannot disable auto-snyc (nor pruning and self heal) of an application resource via the UI. It seems to me that argoCD is overwriting these changes immediately as it tries to sync and auto-heal again - which Im trying to disable! So the UI buttons must get around the self-healing and auto-syncing process to be able to work…

Any news?

I’m experiencing the same issue.

To disable the sync in the YAML manifest I set syncPolicy: {} but I would like to keep the syncOption, and today is impossible to have both.

https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#fail-the-sync-if-a-shared-resource-is-found

syncPolicy:
    syncOptions:
      - FailOnSharedResource=true