Logic behind ArgoCD sync of Application

423 views Asked by At

I wanted to force a sync of an Application in ArgoCD (v2.7.8) to re-create all resources, even if not all of them were updated in a Git repository. I didn't find any documentation specific for this case, but somehow I've managed to make it using the following arguments (body) for a /api/v1/applications/{name}/sync operation:

{
    "prune": true,
    "strategy": {
        "hook": {
            "force": true
        }
    },
    "syncOptions": {
        "items": ["Replace=true"]
    }
}

But this set of parameters makes me confused, because every options shall not destroy and re-create a resource, if it was not modified in the repository.

  1. The 'prune' option shall remove a resource if it is not defined in Git, but no resources are deleted from the repository in my case. (https://argo-cd.readthedocs.io/en/stable/user-guide/auto_sync/#automatic-pruning, https://argo-cd.readthedocs.io/en/stable/user-guide/sync-kubectl/#prune).
  2. The 'force' option shall add '--force' to 'kubectl' command, but that shall not influence whether the resource shall be updated or replaced (https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#replace-resource-instead-of-applying-changes).
  3. The 'Replace=true' option shall use 'kubectl replace' instead of 'apply', but it shall not influence whether the resource shall be updated or replaced (https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#replace-resource-instead-of-applying-changes).

How and why does it work in my case?

0

There are 0 answers