From ea32243aeac301ee68a507cf43292601fa79b437 Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Sun, 17 Jan 2021 22:28:49 -0800 Subject: [PATCH] docs: document email service integration (#152) --- docs/index.md | 27 +++++++++------------- docs/services/email.md | 47 +++++++++++++++++++++++++++++++++++++++ docs/services/overview.md | 1 + mkdocs.yml | 1 + 4 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 docs/services/email.md diff --git a/docs/index.md b/docs/index.md index d668c997..c3036f38 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,34 +20,29 @@ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argoc kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/release-1.0/catalog/install.yaml ``` -* Configure Slack integration - -```bash -kubectl apply -n argocd -f - << EOF -apiVersion: v1 -kind: ConfigMap -metadata: - name: argocd-notifications-cm -data: - service.slack: | - token: $slack-token -EOF -``` - -* Add Slack token to `argocd-notifications-secret` secret +* Add Email username and password token to `argocd-notifications-secret` secret ```bash +export EMAIL_USER= +export PASSWORD= kubectl apply -n argocd -f - << EOF apiVersion: v1 kind: Secret metadata: name: argocd-notifications-secret stringData: - slack-token: + email-username: $EMAIL_USER + email-password: $PASSWORD type: Opaque EOF ``` +* Register Email notification service + +```bash +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 }" }}' +``` + * Subscribe to notifications by adding the `notifications.argoproj.io/subscribe.on-sync-succeeded.slack` annotation to the Argo CD application or project: ```bash diff --git a/docs/services/email.md b/docs/services/email.md new file mode 100644 index 00000000..efa2f5e9 --- /dev/null +++ b/docs/services/email.md @@ -0,0 +1,47 @@ +# Email + +## Parameters + +The Email notification service sends email notifications using SMTP protocol and requires specifying the following settings: + +* `host` - the SMTP server host name +* `port` - the SMTP server port +* `username` - username +* `password` - password +* `from` - from email address + +## Example + +The following snippet contains sample Gmail service configuration: + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: argocd-notifications-cm +data: + service.email.gmail: | + username: $email-username + password: $email-password + host: smtp.gmail.com + port: 465 + from: $email-username +``` + +## Template + +Notification templates support specifying subject for email notifications: + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: argocd-notifications-cm +data: + template.app-sync-succeeded: | + email: + subject: Application {{.app.metadata.name}} has been successfully synced. + message: | + {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}. + Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true . +``` \ No newline at end of file diff --git a/docs/services/overview.md b/docs/services/overview.md index 1cdcee1f..632497e6 100644 --- a/docs/services/overview.md +++ b/docs/services/overview.md @@ -30,6 +30,7 @@ that leverages [Mattermost](https://mattermost.com/): ## Service Types +* [Email](./email.md) * [Slack](./slack.md) * [Opsgenie](./opsgenie.md) * [Grafana](./grafana.md) diff --git a/mkdocs.yml b/mkdocs.yml index 939e810e..b1301b5f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -32,6 +32,7 @@ nav: - subscriptions.md - Notification Services: - services/overview.md + - services/email.md - services/slack.md - services/opsgenie.md - services/grafana.md