Reputation: 545
We have an ArgoCD project. In this project we have multiple apps (lets call them A, B, and C), which pass messages to each other via a Kafka cluster. In order to do this the topics need to be created.
App A is responsible for managing the Kafka cluster (amongst other things). We have a PreSync hook in app A for a job to create and configure the topics before updating the other resources, which apps B and C depend on.
This means that we need app A to sync before the other apps to ensure smooth rollout. To try to manage this we added app A to SyncWave -1
, with others in the default 0
kind: Application
metadata:
name: "A"
annotations:
argocd.argoproj.io/sync-wave: "-1"
Our original assumption (perhaps foolishly) was that sync coordination applied within a project, however, it seems that it is only applied within an app.
So what happens is that the resources in app A wait for the PreSync hook to provision the topics as expected, but apps B and C do not wait for app A to be in sync.
Is there a way to control the order / dependencies of syncing between apps inside a project?
I have seen mention of an "app-of-apps" pattern, where you have one app which deploys all other apps. Would doing this allow us to leverage the SyncWave to ensure that app A fully resolves before attempting to sync apps B and C? If not, is there another way?
Upvotes: 10
Views: 7845
Reputation: 51
As of version 1.8 of ArgoCD the part responsible for making this possible has been removed. More details can be found here .
The argocd-cm will need to be updated to enable the app of an app health check using resource.customizations part like on below example. More details can be found here and here.
---
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
data:
resource.customizations: |
argoproj.io/Application:
health.lua: |
hs = {}
hs.status = "Progressing"
hs.message = ""
if obj.status ~= nil then
if obj.status.health ~= nil then
hs.status = obj.status.health.status
if obj.status.health.message ~= nil then
hs.message = obj.status.health.message
end
end
end
return hs
Upvotes: 4
Reputation: 848
We have an app-of-apps (bootstrap app) and that is how we orchestrate sync-waves between apps. I have had no luck however ALSO adding sync-waves to the manifests IN each app. Seems from the docs that manifests are applied by Kind (e.g., namespaces first) and then alphabetically by name (case insensitive).
Upvotes: 1