github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/notifications/argocd-notifications-cm.yaml (about)

     1  apiVersion: v1
     2  kind: ConfigMap
     3  metadata:
     4    name: argocd-notifications-cm
     5  data:
     6    # Triggers define the condition when the notification should be sent and list of templates required to generate the message
     7    # Recipients can subscribe to the trigger and specify the required message template and destination notification service.
     8    trigger.on-sync-status-unknown: |
     9      - when: app.status.sync.status == 'Unknown'
    10        send: [my-custom-template]
    11  
    12    # Optional 'oncePer' property ensure that notification is sent only once per specified field value
    13    # E.g. following is triggered once per sync revision
    14    trigger.on-deployed: |
    15      - when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
    16        oncePer: app.status.sync.revision
    17        send: [app-sync-succeeded]
    18  
    19    # Templates are used to generate the notification template message
    20    template.my-custom-template: |
    21      message: |
    22        Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
    23  
    24    # Templates might have notification service specific fields. E.g. slack message might include annotations
    25    template.my-custom-template-slack-template: |
    26      message: |
    27        Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
    28        Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
    29      email:
    30        subject: Application {{.app.metadata.name}} sync status is {{.app.status.sync.status}}
    31      slack:
    32        attachments: |
    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 subscription
    40    defaultTriggers: |
    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 format
    45    # Service format key is: service.<type>.<optional-custom-name>
    46    #  Slack
    47    service.slack: |
    48      token: $slack-token
    49      username: <override-username> # optional username
    50      icon: <override-icon> # optional icon for the message (supports both emoij and url notation)
    51  
    52    #  Slack based notifier with name mattermost
    53    service.slack.mattermost: |
    54      apiURL: https://my-mattermost-url.com/api
    55      token: $slack-token
    56      username: <override-username> # optional username
    57      icon: <override-icon> # optional icon for the message (supports both emoij and url notation)
    58  
    59    #  Email
    60    service.email: |
    61      host: smtp.gmail.com
    62      port: 587
    63      from: <myemail>@gmail.com
    64      username: $email-username
    65      password: $email-password
    66  
    67    #  Opsgenie
    68    service.opsgenie: |
    69      apiUrl: api.opsgenie.com
    70      apiKeys:
    71        $opsgenie-team-id: $opsgenie-team-api-key
    72        ...
    73  
    74    #  Telegram
    75    service.telegram: |
    76      token: $telegram-token
    77  
    78    # Context holds list of variables that can be referenced in templates
    79    context: |
    80      argocdUrl: https://cd.apps.argoproj.io/
    81  
    82    # Contains centrally managed global application subscriptions
    83    subscriptions: |
    84      # subscription for on-sync-status-unknown trigger notifications
    85      - recipients:
    86        - slack:test2
    87        - email:test@gmail.com
    88        triggers:
    89        - on-sync-status-unknown
    90      # subscription restricted to applications with matching labels only
    91      - recipients:
    92        - slack:test3
    93        selector: test=true
    94        triggers:
    95        - on-sync-status-unknown