Sync Phases and Waves

v1.1

Argo CD executes a sync operation in a number of steps. At a high-level, there are three phases pre-sync, sync and post-sync.

Within each phase you can have one or more waves, than allows you to ensure certain resources are healthy before subsequent resources are synced.

How Do I Configure Phases?

Pre-sync and post-sync can only contain hooks. Apply the hook annotation:

  1. metadata:
  2. annotations:
  3. argocd.argoproj.io/hook: PreSync

Read more about hooks.

How Do I Configure Waves?

Specify the wave using the following annotation:

  1. metadata:
  2. annotations:
  3. argocd.argoproj.io/sync-wave: "5"

Hooks and resources are assigned to wave zero by default. The wave can be negative, so you can create a wave that runs before all other resources.

How Does It Work?

When Argo CD starts a sync, it orders the resources in the following precedence:

  • The phase
  • The wave they are in (lower values first)
  • By kind (e.g. namespaces first)
  • By name

It then determines which the number of the next wave to apply. This is the first number where any resource is out-of-sync or unhealthy.

It applies resources in that wave.

It repeats this process until all phases and waves are in in-sync and healthy.

Because an application can have resources that are unhealthy in the first wave, it may be that the app can never get to healthy.