File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ metadata:
44 name : argocd-notifications-cm
55 namespace : argocd
66data :
7+ # Cluster name - set this to your cluster context name
8+ # You can set this automatically with: kubectl patch configmap argocd-notifications-cm -n argocd -p "{\"data\":{\"cluster-name\":\"$(kubectl config current-context)\"}}"
9+ cluster-name : " CLUSTER_NAME_PLACEHOLDER"
10+
711 # GitHub webhook service configuration
812 service.webhook.github-webhook : |
913 url: https://api.github.com/repos/DevExpGbb/agentic-platform-engineering/dispatches
4246 "message": "{{.app.status.operationState.message}}",
4347 "revision": "{{.app.status.sync.revision}}",
4448 "repo_url": "{{.app.spec.source.repoURL}}",
45- "cluster": "{{.app.spec.destination.server}} ",
49+ "cluster": "$cluster-name ",
4650 "namespace": "{{.app.spec.destination.namespace}}",
4751 "timestamp": "{{.app.status.operationState.finishedAt}}",
4852 "resources": {{toJson .app.status.resources}}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Run this script once when ArgoCD is installed to set the cluster name
3+ # Usage: ./setup-cluster-name.sh
4+
5+ set -e
6+
7+ CLUSTER_NAME=$( kubectl config current-context)
8+
9+ echo " Setting cluster name in ArgoCD notifications: $CLUSTER_NAME "
10+
11+ # Update the cluster-name in the argocd-notifications-cm ConfigMap
12+ kubectl patch configmap argocd-notifications-cm -n argocd \
13+ -p " {\" data\" :{\" cluster-name\" :\" $CLUSTER_NAME \" }}"
14+
15+ # Restart the notifications controller to pick up the change
16+ kubectl rollout restart deployment argocd-notifications-controller -n argocd
17+
18+ echo " ✓ Cluster name configured: $CLUSTER_NAME "
19+ echo " "
20+ echo " ArgoCD notifications will now use cluster name: $CLUSTER_NAME "
Original file line number Diff line number Diff line change @@ -13,20 +13,13 @@ jobs:
1313 runs-on : ubuntu-latest
1414
1515 steps :
16- - name : Get cluster info
17- id : cluster-info
18- run : |
19- CLUSTER_CONTEXT=$(kubectl config current-context 2>/dev/null || echo "unknown")
20- echo "context=$CLUSTER_CONTEXT" >> $GITHUB_OUTPUT
21- continue-on-error : true
22-
2316 - name : Create GitHub Issue
2417 uses : actions/github-script@v7
2518 with :
2619 script : |
2720 const payload = context.payload.client_payload || {};
2821 const appName = payload.app_name || 'unknown';
29- const cluster = payload.cluster || 'unknown ';
22+ const clusterName = payload.cluster || 'in-cluster ';
3023 const namespace = payload.namespace || 'default';
3124 const healthStatus = payload.health_status || 'unknown';
3225 const syncStatus = payload.sync_status || 'unknown';
3629 const timestamp = payload.timestamp || new Date().toISOString();
3730 const resources = payload.resources || [];
3831
39- // Get cluster name - prefer from outputs, fallback to parsing URL
40- const clusterContext = process.env.CLUSTER_CONTEXT || 'unknown';
41- let clusterName = clusterContext !== 'unknown' ? clusterContext : cluster;
42-
4332 // Build degraded resources section
4433 let degradedDetails = '';
4534 const degradedResources = resources.filter(r =>
Original file line number Diff line number Diff line change 11apiVersion : argoproj.io/v1alpha1
22kind : Application
33metadata :
4- name : another-kind-of -working-aks-store
4+ name : half -working-aks-store
55 namespace : argocd
66 annotations :
77 # Enable notifications on sync failures
You can’t perform that action at this time.
0 commit comments