184 lines
6.1 KiB
YAML
184 lines
6.1 KiB
YAML
---
|
|
# Source: argocd/charts/argo-cd/templates/argocd-configs/argocd-notifications-cm.yaml
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: argocd-notifications-cm
|
|
namespace: argocd
|
|
labels:
|
|
helm.sh/chart: argo-cd-9.1.5
|
|
app.kubernetes.io/name: argocd-notifications-controller
|
|
app.kubernetes.io/instance: argocd
|
|
app.kubernetes.io/component: notifications-controller
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/part-of: argocd
|
|
app.kubernetes.io/version: "v3.2.1"
|
|
data:
|
|
context: |
|
|
argocdUrl: https://argocd.example.com
|
|
argocdUrl: https://argocd.alexlebens.net
|
|
service.webhook.ntfy: |
|
|
url: http://ntfy.ntfy/
|
|
headers:
|
|
- name: Authorization
|
|
value: Bearer $ntfy-token
|
|
subscriptions: |
|
|
- recipients:
|
|
- ntfy
|
|
triggers:
|
|
- on-created
|
|
- on-deleted
|
|
- on-deployed
|
|
- on-health-degraded
|
|
- on-sync-failed
|
|
- on-sync-running
|
|
- on-sync-status-unknown
|
|
- on-sync-succeeded
|
|
template.app-created: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} has been created.",
|
|
"title": "Created: {{.app.metadata.name}}",
|
|
"tags": ["building_construction"],
|
|
"priority": 4,
|
|
"click": "{{.context.argocdUrl}}/applications/argocd/{{.app.metadata.name}}"
|
|
}
|
|
template.app-deleted: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} has been deleted",
|
|
"title": "Deleted: {{.app.metadata.name}}",
|
|
"tags": ["warning"],
|
|
"priority": 4,
|
|
"click": "{{.context.argocdUrl}}"
|
|
}
|
|
template.app-deployed: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} is now running new version of deployments manifests",
|
|
"title": "Deployed: {{.app.metadata.name}}",
|
|
"tags": ["+1"],
|
|
"priority": 3,
|
|
"click": "{{.context.argocdUrl}}/applications/argocd/{{.app.metadata.name}}"
|
|
}
|
|
template.app-health-degraded: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} health has degraded",
|
|
"title": "Degraded: {{.app.metadata.name}}",
|
|
"tags": ["rotating_light"],
|
|
"priority": 4,
|
|
"click": "{{.context.argocdUrl}}/applications/argocd/{{.app.metadata.name}}"
|
|
}
|
|
template.app-sync-failed: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} sync has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}}",
|
|
"title": "Sync Failed: {{.app.metadata.name}}",
|
|
"tags": ["rotating_light"],
|
|
"priority": 4,
|
|
"click": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
|
|
}
|
|
template.app-sync-running: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} sync has started at {{.app.status.operationState.startedAt}}",
|
|
"title": "Sync Running: {{.app.metadata.name}}",
|
|
"tags": ["runner"],
|
|
"priority": 3,
|
|
"click": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
|
|
}
|
|
template.app-sync-status-unknown: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} sync status is unknown",
|
|
"title": "Sync Unknown: {{.app.metadata.name}}",
|
|
"tags": ["question"],
|
|
"priority": 3,
|
|
"click": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}"
|
|
}
|
|
template.app-sync-succeeded: |
|
|
webhook:
|
|
ntfy:
|
|
method: POST
|
|
body: |
|
|
{
|
|
"topic": "argocd",
|
|
"message": "{{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}",
|
|
"title": "Sync Succeeded: {{.app.metadata.name}}",
|
|
"tags": ["+1"],
|
|
"priority": 3,
|
|
"click": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
|
|
}
|
|
trigger.on-created: |
|
|
- description: Application {{.app.metadata.name}} has been created.
|
|
oncePer: app.metadata.name
|
|
send:
|
|
- app-created
|
|
when: "true"
|
|
trigger.on-deleted: |
|
|
- description: Application {{.app.metadata.name}} has been deleted.
|
|
oncePer: app.metadata.name
|
|
send:
|
|
- app-deleted
|
|
when: app.metadata.deletionTimestamp != nil
|
|
trigger.on-deployed: |
|
|
- description: Application is synced and healthy. Triggered once per commit.
|
|
oncePer: app.status.operationState.syncResult.revision
|
|
send:
|
|
- app-deployed
|
|
when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
|
|
trigger.on-health-degraded: |
|
|
- description: Application has degraded
|
|
send:
|
|
- app-health-degraded
|
|
when: app.status.health.status == 'Degraded' and time.Now().Sub(time.Parse(app.status.health.lastTransitionTime).Minutes() >= 15
|
|
trigger.on-sync-failed: |
|
|
- description: Application syncing has failed
|
|
send:
|
|
- app-sync-failed
|
|
when: app.status.operationState.phase in ['Error', 'Failed']
|
|
trigger.on-sync-running: |
|
|
- description: Application is being synced
|
|
send:
|
|
- app-sync-running
|
|
when: app.status.operationState.phase in ['Running']
|
|
trigger.on-sync-status-unknown: |
|
|
- description: Application status is 'Unknown'
|
|
send:
|
|
- app-sync-status-unknown
|
|
when: app.status.sync.status == 'Unknown'
|
|
trigger.on-sync-succeeded: |
|
|
- description: Application syncing has succeeded
|
|
send:
|
|
- app-sync-succeeded
|
|
when: app.status.operationState.phase in ['Succeeded']
|