What are ArgoCD's phases and sync waves

argocd phase sync wave

2 min read | by Jordi Prats

Although it's shouldn't be like this, resources ordering can play an important role to successfully deploy your application. We can use ArgoCD's phases and sync waves to tell it how (object dependencies) to deploy the manifest.

When ArgoCD starts a sync operation it takes into account the phase and the wave we have configured. To configure them we can use the following annotations:

  • Using argocd.argoproj.io/hook we can configure the phase, it can be: PreSync, Sync and PostSync for the three main phases, although we can set it to SyncFail to add cleanup logic or Skip to ignore the object
  • Using argocd.argoproj.io/sync-wave we can configure the ordering it will use from within a phase. (lower values first)

Additionally, it will sort resources by Kind and finally by Name

To determine the wave it needs to apply, it uses the lowest number of any resources that are out-of-sync or unhealthy, the default wave is 0. As soon as it applies the resources repeats until all phases and waves are in-sync and healthy.

To give some time for the controllers to react to updates, there's a delay between each sync wave that can be configured using the following environment variable: ARGOCD_SYNC_WAVE_DELAY

apiVersion: v1
kind: Secret
metadata:
  name: vault-token
data:
  token: dGVzdA==
---
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
  name: testvault-backend
  annotations:
    argocd.argoproj.io/sync-wave: "1"
spec:
  provider:
    vault:
      server: "http://testvault.testvault.svc.cluster.local:80"
      path: "secret"
      version: "v2"
      auth:
        tokenSecretRef:
          name: "vault-token"
          key: "token"

Posted on 03/01/2023

Categories