ArgoCD manages GitOps deployments to Kubernetes. When an application syncs successfully, you want that recorded in Alert24 as a change so you can correlate incidents with deployments. Use ArgoCD resource hooks or the ArgoCD Notifications controller.
Option A: ArgoCD Notifications (recommended)
ArgoCD Notifications is the cleanest approach — no manifest changes required.
1. Add a webhook template
In your argocd-notifications-cm ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
namespace: argocd
data:
template.alert24-change: |
webhook:
alert24:
method: POST
path: /api/v1/changes
body: |
{
"summary": "Synced {{.app.metadata.name}} to {{.app.status.sync.revision | substr 0 8}}",
"change_type": "deployment",
"environment": "{{.app.spec.destination.namespace | default \"production\"}}",
"commit_sha": "{{.app.status.sync.revision}}",
"source": "argocd",
"tags": ["argocd", "kubernetes", "{{.app.metadata.name}}"]
}
trigger.on-sync-succeeded: |
- when: app.status.operationState.phase in ['Succeeded']
send: [alert24-change]
service.webhook.alert24: |
url: https://app.alert24.net
headers:
- name: Authorization
value: Bearer $ALERT24_API_KEY
- name: Content-Type
value: application/json
2. Add the API key secret
kubectl create secret generic argocd-notifications-secret \
--from-literal=ALERT24_API_KEY=ak_live_YOUR_KEY \
-n argocd
3. Annotate your Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
annotations:
notifications.argoproj.io/subscribe.on-sync-succeeded.alert24: ""
Option B: Sync hook Job
Add a Kubernetes Job as a PostSync hook to your app's manifests:
apiVersion: batch/v1
kind: Job
metadata:
name: alert24-notify
annotations:
argocd.argoproj.io/hook: PostSync
argocd.argoproj.io/hook-delete-policy: HookSucceeded
spec:
template:
spec:
restartPolicy: Never
containers:
- name: notify
image: curlimages/curl:latest
env:
- name: ALERT24_API_KEY
valueFrom:
secretKeyRef:
name: alert24-secret
key: api-key
command:
- sh
- -c
- |
curl -s -X POST https://app.alert24.net/api/v1/changes \
-H "Authorization: Bearer $ALERT24_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"summary": "ArgoCD synced application",
"change_type": "deployment",
"environment": "production",
"source": "argocd"
}'
Tips
- Option A vs B: ArgoCD Notifications is cleaner and doesn't add resources to your application's manifest. Use Option B if you can't install/configure the notifications controller.
- Revision: The
app.status.sync.revisionin Option A is the Git commit SHA that ArgoCD synced to — map it directly to Alert24'scommit_sha. - Multiple apps: With ArgoCD Notifications, annotate each Application individually to control which apps log to Alert24.