Answers: <p><strong>tl;dr</strong> phases are used to order the running of <em>scripts</em>; waves are used to order the <code>apply</code> of application resources.</p>
  <hr />
  <p>The <code>PreSync</code> and <code>PostSync</code> sync phases are used to run <a href="https://argo-cd.readthedocs.io/en/stable/user-guide/resource_hooks/" rel="nofollow noreferrer">resource hooks</a> - scripts that are supposed to run to completion. For example:</p>
  <ul>
  <li><code>PreSync</code> - can be used to run data migration <em>scripts</em></li>
  <li><code>PostSync</code> - can be used to run a smoke test <em>script</em>, or a <em>script</em> to send a Slack message</li>
  </ul>
  <p>Because hooks are scripts, they tend to be <code>Pod</code>, <code>Job</code> or Argo Workflows.</p>
  <p><strong>Hooks are meant to be deleted</strong> after it runs; if and when exactly depends on the <a href="https://argo-cd.readthedocs.io/en/stable/user-guide/resource_hooks/#hook-deletion-policies" rel="nofollow noreferrer">hook deletion policy</a>.</p>
  <p>On the other hand, resources applied within a sync wave are not scripts, but objects/services/config that are <strong>meant to remain as part of the application after the sync</strong> 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).</p>
  
Answers: CC BY-SA 4.0
Answers: 2024-03-06T13:04:15.790Z
Answers: 2024-03-06T13:04:15.790Z
Answers: d4nyll
Body: <p>Argo CD can synchronize (i.e. apply manifests) in order. The ordering is determined by <a href="https://argo-cd.readthedocs.io/en/stable/user-guide/sync-waves/" rel="nofollow noreferrer"><em>phase</em></a>, <em>wave</em>, resource kind (e.g. <code>Namespace</code>, <code>Deployment</code>), and name.</p>
  <p>There are 3 phases:</p>
  <ul>
  <li><code>PreSync</code></li>
  <li><code>Sync</code></li>
  <li><code>PostSync</code></li>
  </ul>
  <p>Within the <code>Sync</code> phase can be one or more <em>waves</em>, assigned to resources using the <code>argocd.argoproj.io/sync-wave</code> annotation, and has integer values, with the lower-numbered waves being applied first.</p>
  <p>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 <code>PreSync</code> phase vs. assigning to a low-numbered sync wave?</p>
  
Tags: <argocd>
Title: Difference between Sync Phases and Waves?
UserDisplayName: d4nyll
ThreadText: # Difference between Sync Phases and Waves?
  
  (Asked by: username_0 on 2024-03-06)
  
  Argo CD can synchronize (i.e. apply manifests) in order. The ordering is determined by [*phase*](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-waves/), *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?
  
  **Tags:** argocd
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-03-06. Score: 1 | Accepted answer
  
  **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](https://argo-cd.readthedocs.io/en/stable/user-guide/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](https://argo-cd.readthedocs.io/en/stable/user-guide/resource_hooks/#hook-deletion-policies).
  
  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).
  
  
  ---
  
  