Feature : use binary tree as sync-waves dependency graph for deployment
Hello dear ArgoCD users,
I would like to suggest a feature that would be pretty nice to have : being able to define parallel branches of sync-waves deployments in order to deploy/sync resources without waiting an unnecessary amount of time. Here is an example of dependencies it would allow to fasten the deployment of :
Resource2 & Resource4 would be deployed as soon as Resource1 is ready. Resource3 would be deployed as soon as Resource2 is ready. Resource5 would be deployed as soon as Resource4 is ready.
If we define the sync-waves using the following values :
then we would have to wait for Resource4 to be ready before deploying Resource3, which we don't need.
If accepted by the community/maintainers, I already have a PR that would be ready for review. From an user point of view, my solution would consists in adding an annotation to the desired resources which would allow to define a partial ordering on the desired syncwaves.
What do you think?
Can you detail how the sync waves would be configured?
Could this also be solved by nesting apps-of-apps? i.e. have one app represent branch A and another app represent branch B.
Sure, resources will look like that :
apiVersion: v1 kind: xxxx metadata: annotations: argocd.argoproj.io/sync-wave: "N" argocd.argoproj.io/sync-wave-order: "BTree"
the sync-wave-order label will indicate that we need to use a special mathematical ordering on the syncwave value
Still not sure I follow... Can you provide a full example with all 5 resources?
Not sure that the config will be meaningfull without the code but here we go :
Resource1 :
apiVersion: v1 kind: xxxx name: resource1 metadata: annotations: argocd.argoproj.io/sync-wave: "1" argocd.argoproj.io/sync-wave-binary-tree-ordering: "true"
Resource2 :
apiVersion: v1 kind: xxxx name: resource2 metadata: annotations: argocd.argoproj.io/sync-wave: "2" argocd.argoproj.io/sync-wave-binary-tree-ordering: "true"
Resource3 :
apiVersion: v1 kind: xxxx name: resource3 metadata: annotations: argocd.argoproj.io/sync-wave: "4" argocd.argoproj.io/sync-wave-binary-tree-ordering: "true"
Resource4 :
apiVersion: v1 kind: xxxx name: resource1 metadata: annotations: argocd.argoproj.io/sync-wave: "3" argocd.argoproj.io/sync-wave-binary-tree-ordering: "true"
Resource5 :
apiVersion: v1 kind: xxxx name: resource1 metadata: annotations: argocd.argoproj.io/sync-wave: "6" argocd.argoproj.io/sync-wave-binary-tree-ordering: "true"
the ordering of these resources will be done using a complete binary tree
namely:
Note that the values 5 and 7 in this diagram are just here to represent the ordering of integers from 1 to 7 and don't correspond to any resources. Note also that the solution I foresee doesn't only apply to 2 parallel branches, but it could also be applied to an entire rooted binary tree dependency graph.
P.S: I changed the annotation's name/values of the previous post to more meaningful ones
To answer your question about if it could be managed by nesting apps-of-apps: if the binary tree dependency graph gets big, we would need a ton of apps.
To my mind this won't be an efficient solution.
I remain at your disposal if you need any complementary explanation/information!
@crenshaw-dev I provided complementary information here : https://github.com/argoproj/gitops-engine/pull/744#issuecomment-3041295994