From 38cacd468ff6e2467b6aef90fa10bf8696d0a104 Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Fri, 26 Nov 2021 11:57:02 +0700 Subject: [PATCH] feat(bootstrap): add health check and sync wave for ApplicationSets --- bootstrap/Makefile | 2 +- bootstrap/argocd/argocd-cm-patch.yaml | 13 +++++++++++++ bootstrap/root-app/applicationsets/apps.yaml | 4 ++-- bootstrap/root-app/applicationsets/bootstrap.yaml | 4 ++-- bootstrap/root-app/applicationsets/platform.yaml | 4 ++-- bootstrap/root-app/applicationsets/system.yaml | 4 ++-- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/bootstrap/Makefile b/bootstrap/Makefile index e658971a..7fc2c764 100644 --- a/bootstrap/Makefile +++ b/bootstrap/Makefile @@ -12,4 +12,4 @@ argocd: .PHONY: root-app root-app: - kustomize build ./root-app | kubectl apply -f - + kubectl apply -f root-app/applicationsets/bootstrap.yaml diff --git a/bootstrap/argocd/argocd-cm-patch.yaml b/bootstrap/argocd/argocd-cm-patch.yaml index 461d3120..8593d359 100644 --- a/bootstrap/argocd/argocd-cm-patch.yaml +++ b/bootstrap/argocd/argocd-cm-patch.yaml @@ -16,3 +16,16 @@ data: end end return hs + resource.customizations.health.argoproj.io_ApplicationSet: | + 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 diff --git a/bootstrap/root-app/applicationsets/apps.yaml b/bootstrap/root-app/applicationsets/apps.yaml index 5fcbb132..49aaa6bd 100644 --- a/bootstrap/root-app/applicationsets/apps.yaml +++ b/bootstrap/root-app/applicationsets/apps.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: apps + annotations: + argocd.argoproj.io/sync-wave: "4" spec: generators: - git: @@ -12,8 +14,6 @@ spec: template: metadata: name: '{{path.basename}}' - annotations: - argocd.argoproj.io/sync-wave: "4" spec: destination: name: in-cluster diff --git a/bootstrap/root-app/applicationsets/bootstrap.yaml b/bootstrap/root-app/applicationsets/bootstrap.yaml index 4a2c9023..03d449f0 100644 --- a/bootstrap/root-app/applicationsets/bootstrap.yaml +++ b/bootstrap/root-app/applicationsets/bootstrap.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: bootstrap + annotations: + argocd.argoproj.io/sync-wave: "1" spec: generators: - git: @@ -12,8 +14,6 @@ spec: template: metadata: name: '{{path.basename}}' - annotations: - argocd.argoproj.io/sync-wave: "1" spec: destination: name: in-cluster diff --git a/bootstrap/root-app/applicationsets/platform.yaml b/bootstrap/root-app/applicationsets/platform.yaml index 6a3cd709..6d1cb270 100644 --- a/bootstrap/root-app/applicationsets/platform.yaml +++ b/bootstrap/root-app/applicationsets/platform.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: platform + annotations: + argocd.argoproj.io/sync-wave: "3" spec: generators: - git: @@ -12,8 +14,6 @@ spec: template: metadata: name: '{{path.basename}}' - annotations: - argocd.argoproj.io/sync-wave: "3" spec: destination: name: in-cluster diff --git a/bootstrap/root-app/applicationsets/system.yaml b/bootstrap/root-app/applicationsets/system.yaml index 9c31e276..0d0e0c19 100644 --- a/bootstrap/root-app/applicationsets/system.yaml +++ b/bootstrap/root-app/applicationsets/system.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: system + annotations: + argocd.argoproj.io/sync-wave: "2" spec: generators: - git: @@ -12,8 +14,6 @@ spec: template: metadata: name: '{{path.basename}}' - annotations: - argocd.argoproj.io/sync-wave: "2" spec: destination: name: in-cluster