Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync waves not working #2603

Open
MonicaMagoniCom opened this issue Mar 25, 2024 · 3 comments
Open

Sync waves not working #2603

MonicaMagoniCom opened this issue Mar 25, 2024 · 3 comments

Comments

@MonicaMagoniCom
Copy link

MonicaMagoniCom commented Mar 25, 2024

Describe the bug

I've added in my application.yaml the sync-wave feature. For example i've put on one application the following annotation:

  - name: rabbitmq
    namespace: argocd
    additionalAnnotations:
      argocd.argoproj.io/hook: PreSync
      argocd.argoproj.io/sync-wave: "-2"
    project: default

While the other applications don't have anything. Anyway it is not working, all the applications are created all together.

Related helm chart

argocd-apps

Helm chart version

1.6.2

To Reproduce

use the annotation for the sync wave

Expected behavior

Application order reflects the sync-wave annotation (rabbitmq is the first one created)

Screenshots

No response

Additional context

No response

@mkilchhofer
Copy link
Member

mkilchhofer commented Mar 25, 2024

I'd not use PreSync on app level.
PreSync resources are deleted before a sync starts and thus will result in app downtime and/or data loss.

image

Ref: https://argo-cd.readthedocs.io/en/stable/user-guide/resource_hooks/

Although sync wave should work. But IMO it depends on the selected sync options of this app.

@MonicaMagoniCom
Copy link
Author

My aim is to give an order of deployment of applications. How can I reach that?

@pdrastil
Copy link
Member

Hi @MonicaMagoniCom getting fixed order of deployments is tricky to achieve as the sync waves works only inside same Application.

For example you can create this structure in pseudo code:

applications:
  first: cert-manager
  second: nginx

however this ordering only means that Application resource cert-manager gets created before nginx. It doesn't mean that cert-manager is fully deployed and working before deploying nginx as there is minimal delay between Application resources that get created. This is a result of change in Argo CD v1.8 health reporting for Applications that is used by sync waves. See: https://argo-cd.readthedocs.io/en/stable/operator-manual/upgrading/1.7-1.8/#health-assessment-of-argoprojioapplication-crd-has-been-removed

Options that works:

  1. Enable health reporting for Argo CD Applications as stated in above post to get determinism back
  2. Deploy by other means such as Terraform provider to get fixed order in cluster bootstrap
  3. Use app-of-apps with sync waves that create ApplicationSets - Argo will wait until AppSet child resources are fully available
  4. Write bootstrap in such a way that ordering doesn't matter / use Application retry function to get eventual good state

@pdrastil pdrastil added question and removed bug labels May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants