github.com/argoproj-labs/argocd-operator@v0.10.0/docs/reference/notificationsconfiguration.md (about)

     1  # NotificationsConfiguration
     2  
     3  The `NotificationsConfiguration` resource is a Kubernetes Custom Resource (CRD) that allows users to add the triggers, templates, services and subscriptions to the Argo CD Notifications Configmap.
     4  
     5  A `NotificationsConfiguration` custom resource with name `default-notifications-configuration` is created **OOTB** with default configuration. Users should update this custom resource with their templates, triggers, services, subscriptios or any other configuration.
     6  
     7  **Note:** 
     8  - Any configuration changes should be made to the `default-notifications-configuration` only. At this point, we do not support any custom resources of kind `NotificationsConfiguration` created by the users.
     9  - Any modifications to the `argocd-notifications-cm` will be reconciled back by the `NotificationsConfiguration` controller of the Argo CD operator instance.
    10  
    11  The `NotificationsConfiguration` Custom Resource consists of the following properties.
    12  
    13  Name | Default | Description
    14  --- | --- | ---
    15  **Templates** | [Empty] | Triggers define the condition when the notification should be sent and list of templates required to generate the message.
    16  **Triggers** | [Empty] | Templates are used to generate the notification template message.
    17  **Services** | [Empty] | Services are used to deliver message.
    18  **Subscriptions** | [Empty] | Subscriptions contain centrally managed global application subscriptions.
    19  
    20  ## Templates Example
    21  
    22  The following example shows how to add templates to the `argocd-notification-cm` using the `default-notifications-configuration` custom resource.
    23  
    24  ``` yaml
    25  apiVersion: argoproj.io/v1alpha1
    26  kind: NotificationsConfiguration
    27  metadata:
    28   name: default-notifications-configuration
    29  spec:
    30   templates:
    31    template.my-custom-template: |
    32      message: |
    33        Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
    34  
    35  ```
    36  
    37  ## Triggers Example
    38  
    39  The following example shows how to add Triggers to the `argocd-notification-cm` using the `default-notifications-configuration` custom resource.
    40  
    41  ``` yaml
    42  apiVersion: argoproj.io/v1alpha1
    43  kind: NotificationsConfiguration
    44  metadata:
    45   name: default-notifications-configuration
    46  spec:
    47   triggers:
    48    trigger.on-sync-status-unknown: |
    49      - when: app.status.sync.status == 'Unknown'
    50        send: [my-custom-template]
    51  ```
    52  
    53  ## Services Example
    54  
    55  The following example shows how to add Services to the `argocd-notification-cm` using the `default-notifications-configuration` custom resource.
    56  
    57  ``` yaml
    58  apiVersion: argoproj.io/v1alpha1
    59  kind: NotificationsConfiguration
    60  metadata:
    61   name: default-notifications-configuration
    62  spec:
    63   Services:
    64    service.slack: |
    65      token: $slack-token
    66      username: <override-username> # optional username
    67      icon: <override-icon> # optional icon for the message (supports both emoij and url notation)
    68  ```
    69  
    70  ## Subscriptions Example
    71  
    72  The following example shows how to add Subscriptions to the `argocd-notification-cm` using the `default-notifications-configuration` custom resource.
    73  
    74  ``` yaml
    75  apiVersion: argoproj.io/v1alpha1
    76  kind: NotificationsConfiguration
    77  metadata:
    78   name: default-notifications-configuration
    79  spec:
    80   Subscriptions: |
    81    subscriptions: |
    82      # subscription for on-sync-status-unknown trigger notifications
    83      - recipients:
    84        - slack:test2
    85        - email:test@gmail.com
    86        triggers:
    87        - on-sync-status-unknown
    88      # subscription restricted to applications with matching labels only
    89      - recipients:
    90        - slack:test3
    91        selector: test=true
    92        triggers:
    93        - on-sync-status-unknown
    94  ```