Skip to content

Disable/enable of autosync loses automated sync settings #23330

@fffinkel

Description

@fffinkel

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When disabling and then re-enabling autosync in the UI for a given application, the settings for autosync (prune, selfHeal and allowEmpty) are not restored.

We use an app of apps pattern, which has autosync enabled. This means that if we have autosync enabled for our app of apps, these settings are restored automatically. This is problematic however, because a sync of our app of apps means that the disabling of autosync for a given application is re-enabled, seemingly randomly from the perspective of the application engineer that disabled it. The fix to this problem, we're ignoring /spec/syncPolicy/automated in the diff calculation, but this means we never get prune: true back for our applications.

To Reproduce

Starting with an Argo configured to use an app of apps pattern:

  1. Disable autosync for the app of apps
  2. Add a setting to a given application's manifest at /spec/syncPolicy/automated, e.g. prune: true
spec:
  syncPolicy:
    automated:
      prune: true
  1. Disable autosync for that application
  2. Re-enable autosync for that application
  3. Observe that /spec/syncPolicy/automated is now set to {} for that application
spec:
  syncPolicy:
    automated: {}

Expected behavior

We expect any key/values in /spec/syncPolicy/automated to be restored when autosync is re-enabled for a given application.

Screenshots

n/a

Version

[17:51] % argocd version
argocd: v2.14.5+f463a94
  BuildDate: 2025-03-11T04:57:12Z
  GitCommit: f463a945d57267e9691cede37021d9ddc5994f36
  GitTreeState: clean
  GoVersion: go1.24.1
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v2.14.13+5ad281e
  BuildDate: 2025-05-28T14:51:52Z
  GitCommit: 5ad281ef56a7ff11aab743ab004a470bf3ecf08c
  GitTreeState: clean
  GoVersion: go1.23.3
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.4.3 2024-07-19T16:40:33Z
  Helm Version: v3.16.3+gcfd0749
  Kubectl Version: v0.31.0
  Jsonnet Version: v0.20.0

Logs

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions