1

Argo CD can synchronize (i.e. apply manifests) in order. The ordering is determined by phase, wave, resource kind (e.g. Namespace, Deployment), and name.

There are 3 phases:

  • PreSync
  • Sync
  • PostSync

Within the Sync phase can be one or more waves, assigned to resources using the argocd.argoproj.io/sync-wave annotation, and has integer values, with the lower-numbered waves being applied first.

The question is - what's the purpose of sync phases when the ordering can already be achieved using sync waves? Or - what's the difference assigning a resource to the PreSync phase vs. assigning to a low-numbered sync wave?

d4nyll
  • 121
  • 5

1 Answers1

1

tl;dr phases are used to order the running of scripts; waves are used to order the apply of application resources.


The PreSync and PostSync sync phases are used to run resource hooks - scripts that are supposed to run to completion. For example:

  • PreSync - can be used to run data migration scripts
  • PostSync - can be used to run a smoke test script, or a script to send a Slack message

Because hooks are scripts, they tend to be Pod, Job or Argo Workflows.

Hooks are meant to be deleted after it runs; if and when exactly depends on the hook deletion policy.

On the other hand, resources applied within a sync wave are not scripts, but objects/services/config that are meant to remain as part of the application after the sync is over. Sync waves exists so you can dictate the order these resources are applied (e.g. make sure one service is healthy before starting another one).

d4nyll
  • 121
  • 5