Skip to content

Commit e5d2bd3

Browse files
committed
fix: Add resource group configuration to ArgoCD notifications
1 parent a7fd7eb commit e5d2bd3

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎Act-3/argocd-notifications-config.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ data:
88
# You can set this automatically with: kubectl patch configmap argocd-notifications-cm -n argocd -p "{\"data\":{\"cluster-name\":\"$(kubectl config current-context)\"}}"
99
cluster-name: "CLUSTER_NAME_PLACEHOLDER"
1010

11+
# Resource Group - set this from node label kubernetes.azure.com/network-resourcegroup
12+
# You can set this automatically with: kubectl patch configmap argocd-notifications-cm -n argocd -p "{\"data\":{\"resource-group\":\"$(kubectl get nodes -o jsonpath='{.items[0].metadata.labels.kubernetes\.azure\.com/network-resourcegroup}')\"}}"
13+
resource-group: "RESOURCE_GROUP_PLACEHOLDER"
14+
1115
# GitHub webhook service configuration
1216
service.webhook.github-webhook: |
1317
url: https://api.github.com/repos/DevExpGbb/agentic-platform-engineering/dispatches
@@ -47,6 +51,7 @@ data:
4751
"revision": "{{.app.status.sync.revision}}",
4852
"repo_url": "{{.app.spec.source.repoURL}}",
4953
"cluster": "$cluster-name",
54+
"resource_group": "$resource-group",
5055
"namespace": "{{.app.spec.destination.namespace}}",
5156
"timestamp": "{{.app.status.operationState.finishedAt}}",
5257
"resources": {{toJson .app.status.resources}}

‎Act-3/setup-cluster-name.sh‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
#!/bin/bash
2-
# Run this script once when ArgoCD is installed to set the cluster name
2+
# Run this script once when ArgoCD is installed to set the cluster name and resource group
33
# Usage: ./setup-cluster-name.sh
44

55
set -e
66

77
CLUSTER_NAME=$(kubectl config current-context)
8+
RESOURCE_GROUP=$(kubectl get nodes -o jsonpath='{.items[0].metadata.labels.kubernetes\.azure\.com/network-resourcegroup}')
89

910
echo "Setting cluster name in ArgoCD notifications: $CLUSTER_NAME"
11+
echo "Setting resource group in ArgoCD notifications: $RESOURCE_GROUP"
1012

11-
# Update the cluster-name in the argocd-notifications-cm ConfigMap
13+
# Update the cluster-name and resource-group in the argocd-notifications-cm ConfigMap
1214
kubectl patch configmap argocd-notifications-cm -n argocd \
13-
-p "{\"data\":{\"cluster-name\":\"$CLUSTER_NAME\"}}"
15+
-p "{\"data\":{\"cluster-name\":\"$CLUSTER_NAME\",\"resource-group\":\"$RESOURCE_GROUP\"}}"
1416

1517
# Restart the notifications controller to pick up the change
1618
kubectl rollout restart deployment argocd-notifications-controller -n argocd
1719

1820
echo "✓ Cluster name configured: $CLUSTER_NAME"
21+
echo "✓ Resource group configured: $RESOURCE_GROUP"
1922
echo ""
20-
echo "ArgoCD notifications will now use cluster name: $CLUSTER_NAME"
23+
echo "ArgoCD notifications will now use cluster name: $CLUSTER_NAME and resource group: $RESOURCE_GROUP"

0 commit comments

Comments
 (0)