argo-cd
95 строк · 3.4 Кб
1apiVersion: v12kind: ConfigMap3metadata:4name: argocd-notifications-cm5data:6# Triggers define the condition when the notification should be sent and list of templates required to generate the message7# Recipients can subscribe to the trigger and specify the required message template and destination notification service.8trigger.on-sync-status-unknown: |9- when: app.status.sync.status == 'Unknown'
10send: [my-custom-template]
11
12# Optional 'oncePer' property ensure that notification is sent only once per specified field value13# E.g. following is triggered once per sync revision14trigger.on-deployed: |15- when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
16oncePer: app.status.sync.revision
17send: [app-sync-succeeded]
18
19# Templates are used to generate the notification template message20template.my-custom-template: |21message: |
22Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
23
24# Templates might have notification service specific fields. E.g. slack message might include annotations25template.my-custom-template-slack-template: |26message: |
27Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
28Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
29email:
30subject: Application {{.app.metadata.name}} sync status is {{.app.status.sync.status}}
31slack:
32attachments: |
33[{
34"title": "{{.app.metadata.name}}",
35"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
36"color": "#18be52"
37}]
38
39# Holds list of triggers that are used by default if trigger is not specified explicitly in the subscription40defaultTriggers: |41- on-sync-status-unknown
42
43# Notification services are used to deliver message.44# Service definition might reference values from argocd-notifications-secret Secret using $my-key format45# Service format key is: service.<type>.<optional-custom-name>46# Slack47service.slack: |48token: $slack-token
49username: <override-username> # optional username
50icon: <override-icon> # optional icon for the message (supports both emoij and url notation)
51
52# Slack based notifier with name mattermost53service.slack.mattermost: |54apiURL: https://my-mattermost-url.com/api
55token: $slack-token
56username: <override-username> # optional username
57icon: <override-icon> # optional icon for the message (supports both emoij and url notation)
58
5960service.email: |61host: smtp.gmail.com
62port: 587
63from: <myemail>@gmail.com
64username: $email-username
65password: $email-password
66
67# Opsgenie68service.opsgenie: |69apiUrl: api.opsgenie.com
70apiKeys:
71$opsgenie-team-id: $opsgenie-team-api-key
72...
73
74# Telegram75service.telegram: |76token: $telegram-token
77
78# Context holds list of variables that can be referenced in templates79context: |80argocdUrl: https://cd.apps.argoproj.io/
81
82# Contains centrally managed global application subscriptions83subscriptions: |84# subscription for on-sync-status-unknown trigger notifications
85- recipients:
86- slack:test2
87- email:test@gmail.com
88triggers:
89- on-sync-status-unknown
90# subscription restricted to applications with matching labels only
91- recipients:
92- slack:test3
93selector: test=true
94triggers:
95- on-sync-status-unknown