github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/notifications/index.md (about) 1 # Notifications Overview 2 3 Argo CD Notifications continuously monitors Argo CD applications and provides a flexible way to notify 4 users about important changes in the application state. Using a flexible mechanism of 5 [triggers](triggers.md) and [templates](templates.md) you can configure when the notification should be sent as 6 well as notification content. Argo CD Notifications includes the [catalog](catalog.md) of useful triggers and templates. 7 So you can just use them instead of reinventing new ones. 8 9 ## Getting Started 10 11 * Install Triggers and Templates from the catalog 12 13 ```bash 14 kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/notifications_catalog/install.yaml 15 ``` 16 17 * Add Email username and password token to `argocd-notifications-secret` secret 18 19 ```bash 20 EMAIL_USER=<your-username> 21 PASSWORD=<your-password> 22 23 kubectl apply -n argocd -f - << EOF 24 apiVersion: v1 25 kind: Secret 26 metadata: 27 name: argocd-notifications-secret 28 stringData: 29 email-username: $EMAIL_USER 30 email-password: $PASSWORD 31 type: Opaque 32 EOF 33 ``` 34 35 * Register Email notification service 36 37 ```bash 38 kubectl patch cm argocd-notifications-cm -n argocd --type merge -p '{"data": {"service.email.gmail": "{ username: $email-username, password: $email-password, host: smtp.gmail.com, port: 465, from: $email-username }" }}' 39 ``` 40 41 * Subscribe to notifications by adding the `notifications.argoproj.io/subscribe.on-sync-succeeded.slack` annotation to the Argo CD application or project: 42 43 ```bash 44 kubectl patch app <my-app> -n argocd -p '{"metadata": {"annotations": {"notifications.argoproj.io/subscribe.on-sync-succeeded.slack":"<my-channel>"}}}' --type merge 45 ``` 46 47 Try syncing an application to get notified when the sync is completed. 48 49 ## Namespace based configuration 50 51 A common installation method for Argo CD Notifications is to install it in a dedicated namespace to manage a whole cluster. In this case, the administrator is the only 52 person who can configure notifications in that namespace generally. However, in some cases, it is required to allow end-users to configure notifications 53 for their Argo CD applications. For example, the end-user can configure notifications for their Argo CD application in the namespace where they have access to and their Argo CD application is running in. 54 55 This feature is based on applications in any namespace. See [applications in any namespace](../app-any-namespace.md) page for more information. 56 57 In order to enable this feature, the Argo CD administrator must reconfigure the argocd-notification-controller workloads to add `--application-namespaces` and `--self-service-notification-enabled` parameters to the container's startup command. 58 `--application-namespaces` controls the list of namespaces that Argo CD applications are in. `--self-service-notification-enabled` turns on this feature. 59 60 The startup parameters for both can also be conveniently set up and kept in sync by specifying 61 the `application.namespaces` and `notificationscontroller.selfservice.enabled` in the argocd-cmd-params-cm ConfigMap instead of changing the manifests for the respective workloads. For example: 62 63 ```yaml 64 apiVersion: v1 65 kind: ConfigMap 66 metadata: 67 name: argocd-cmd-params-cm 68 data: 69 application.namespaces: app-team-one, app-team-two 70 notificationscontroller.selfservice.enabled: "true" 71 ``` 72 73 To use this feature, you can deploy configmap named `argocd-notifications-cm` and possibly a secret `argocd-notifications-secret` in the namespace where the Argo CD application lives. 74 75 When it is configured this way the controller will send notifications using both the controller level configuration (the configmap located in the same namespaces as the controller) as well as 76 the configuration located in the same namespace where the Argo CD application is at. 77 78 Example: Application team wants to receive notifications using PagerDutyV2, when the controller level configuration is only supporting Slack. 79 80 The following two resources are deployed in the namespace where the Argo CD application lives. 81 ```yaml 82 apiVersion: v1 83 kind: ConfigMap 84 metadata: 85 name: argocd-notifications-cm 86 data: 87 service.pagerdutyv2: | 88 serviceKeys: 89 my-service: $pagerduty-key-my-service 90 ... 91 ``` 92 ```yaml 93 apiVersion: v1 94 kind: Secret 95 metadata: 96 name: argo-cd-notification-secret 97 type: Opaque 98 data: 99 pagerduty-key-my-service: <pd-integration-key> 100 ``` 101 102 When an Argo CD application has the following subscriptions, user receives application sync failure message from pager duty. 103 ```yaml 104 apiVersion: argoproj.io/v1alpha1 105 kind: Application 106 metadata: 107 annotations: 108 notifications.argoproj.io/subscribe.on-sync-failed.pagerdutyv2: "<serviceID for Pagerduty>" 109 ``` 110 111 !!! note 112 When the same notification service and trigger are defined in controller level configuration and application level configuration, 113 both notifications will be sent according to its own configuration. 114 115 [Defining and using secrets within notification templates](templates.md/#defining-and-using-secrets-within-notification-templates) function is not available when flag `--self-service-notification-enable` is on.