diff --git a/bootstrap.sh b/bootstrap.sh index 8a8f30e..88c4473 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -31,10 +31,12 @@ ArgoCd() { # install argocd echo "Installing ArgoCD..." + CLUSTER_NAME="${CLUSTER_NAME:-dev-fd-no-svg1}" helm upgrade --install argocd argo-cd \ --repo https://argoproj.github.io/argo-helm \ --namespace argocd --create-namespace \ --values infra/values/argocd-values.yaml \ + --set notifications.context.clusterName="$CLUSTER_NAME" \ --timeout 60s --atomic kubectl apply -f _app-of-apps.yaml -n argocd diff --git a/infra/values/argocd-values.yaml b/infra/values/argocd-values.yaml index 519e64c..725be28 100644 --- a/infra/values/argocd-values.yaml +++ b/infra/values/argocd-values.yaml @@ -26,6 +26,10 @@ notifications: secret: create: false + # Shared context variables available in all templates + context: + clusterName: "dev-fd-no-svg1" + # Define notification templates templates: template.app-syncing: | @@ -34,7 +38,7 @@ notifications: method: POST body: | { - "payload": "🔄 *{{ .app.metadata.name }}* is syncing...\n📦 Revision: {{ .app.status.sync.revision | substr 0 7 }}" + "payload": "{{ .context.clusterName }}: 🔄 *{{ .app.metadata.name }}* is syncing...\n📦 Revision: {{ .app.status.sync.revision | substr 0 7 }}" } template.app-sync-succeeded: | webhook: @@ -42,7 +46,7 @@ notifications: method: POST body: | { - "payload": "✅ *{{ .app.metadata.name }}* sync succeeded\n📦 Revision: {{ .app.status.sync.revision | substr 0 7 }}{{ range .app.status.summary.images }}\n🏷️ Image: {{ . }}{{ end }}" + "payload": "{{ .context.clusterName }}: ✅ *{{ .app.metadata.name }}* sync succeeded\n📦 Revision: {{ .app.status.sync.revision | substr 0 7 }}{{ range .app.status.summary.images }}\n🏷️ Image: {{ . }}{{ end }}" } template.app-sync-failed: | webhook: @@ -50,7 +54,7 @@ notifications: method: POST body: | { - "payload": "❌ *{{ .app.metadata.name }}* sync failed\n📦 Revision: {{ .app.status.sync.revision | substr 0 7 }}\n⚠️ Message: {{ .app.status.operationState.message }}" + "payload": "{{ .context.clusterName }}: ❌ *{{ .app.metadata.name }}* sync failed\n📦 Revision: {{ .app.status.sync.revision | substr 0 7 }}\n⚠️ Message: {{ .app.status.operationState.message }}" } template.app-degraded: | webhook: @@ -58,7 +62,7 @@ notifications: method: POST body: | { - "payload": "⚠️ *{{ .app.metadata.name }}* is degraded\n🏥 Health: {{ .app.status.health.status }}\n💬 Message: {{ .app.status.health.message }}" + "payload": "{{ .context.clusterName }}: ⚠️ *{{ .app.metadata.name }}* is degraded\n🏥 Health: {{ .app.status.health.status }}\n💬 Message: {{ .app.status.health.message }}" } # Define notification triggers