Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmt committed Dec 30, 2020
1 parent 23b4066 commit 7fcd527
Show file tree
Hide file tree
Showing 20 changed files with 568 additions and 345 deletions.
18 changes: 6 additions & 12 deletions docs/argocd-notifications-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ kind: ConfigMap
metadata:
name: argocd-notifications-cm
data:
# Triggers define the condition when the notification should be sent and optional default message template.
# Triggers define the condition when the notification should be sent and list of templates required to generate the message
# Recipients can subscribe to the trigger and specify the required message template and destination notification service.
trigger.on-sync-status-unknown: |
name: on-sync-status-unknown
condition: app.status.sync.status == 'Unknown'
template: my-custom-template
- when: app.status.sync.status == 'Unknown'
send: [my-custom-template]
# Optional 'oncePer' property ensure that notification is sent only once per specified field value
# E.g. following is triggered once per sync revision
trigger.on-deployed: |
condition: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
oncePer: app.status.sync.revision
template: app-sync-succeeded
- when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
oncePer: app.status.sync.revision
send: [app-sync-succeeded]
# Templates are used to generate the notification template message
template.my-custom-template: |
name: my-custom-template
title: Hello {{.app.metadata.name}}
body: |
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
Expand Down Expand Up @@ -79,10 +77,6 @@ data:
# Contains centrally managed global application subscriptions
subscriptions: |
# subscription for all default triggers
- recipients:
- slack:test1
- webhook:github
# subscription for on-sync-status-unknown trigger notifications
- recipients:
- slack:test2
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions docs/recipients/slack-bot.md → docs/bots/slack-bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
The Slack bot leverages [slash commands](https://api.slack.com/interactivity/slash-commands). The bot allows slack users
to view existing channel subscriptions and subscribe or unsubscribe channels.

1. Make sure bot component is [installed](./bot.md).
1. Make sure bot component is [installed](./overview.md).
1. Configure slack [integration](../services/slack.md).
1. In the slack application settings page navigate to the 'Slash Commands' section and click 'Create New Command' button.
1. Fill in new slack command details
![image](https://user-images.githubusercontent.com/426437/75645798-2e022480-5bfc-11ea-8682-5ce362bdcc9a.png)
1. In the slack application settings page navigate to the 'Basic Information' section and copy 'Signing Secret' from the 'App Credentials' section.
1. Add `signingSecret` to the slack configuration in the `notifiers.yaml` field of the `argocd-notification-secret`:
1. Add `signingSecret` to the slack configuration.

```yaml
apiVersion: v1
kind: Secret
kind: ConfigMap
metadata:
name: argocd-notifications-secret
stringData:
notifiers.yaml: |
slack:
token: <my-token>
signingSecret: <my-secret>
name: argocd-notifications-cm
data:
service.slack:
token: $slack-token
signingSecret: $slack-signing-secret
```
## Commands
Expand Down
File renamed without changes.
19 changes: 0 additions & 19 deletions docs/triggers_and_templates/functions.md → docs/functions.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
## Functions

Both templates and triggers have access to the set of functions.

Trigger example:

```yaml
name: app-operation-stuck
condition: time.Now().Sub(time.Parse(app.status.operationState.startedAt)).Minutes() >= 5
template: my-template
```
Template example:
```yaml
name: my-template
title: Application {{.app.metadata.name}} sync status is {{.app.status.sync.status}}
body: "Author: {{(call .repo.GetCommitMetadata .app.status.sync.revision).Author}}"
```
### **time**
Time related functions.

Expand Down
46 changes: 23 additions & 23 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Argo CD Notifications continuously monitors Argo CD applications and provides a flexible way to notify
users about important changes in the application state. Using a flexible mechanism of
[triggers and templates](./triggers_and_templates/index.md) you can configure when the notification should be sent as
[triggers](./triggers.md) and [templates](./templates.md) you can configure when the notification should be sent as
well as notification content. Argo CD Notifications includes the [catalog](./catalog.md) of useful triggers and templates.
So you can just use them instead of reinventing new ones.

Expand All @@ -11,25 +11,16 @@ So you can just use them instead of reinventing new ones.
* Install Argo CD Notifications

```
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/stable/manifests/install.yaml
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/release-v1.0/manifests/install.yaml
```

* Configure integration with your Slack in `argocd-notifications-secret` secret:
* Install Triggers and Templates from the catalog

```bash
kubectl apply -n argocd -f - << EOF
apiVersion: v1
kind: Secret
metadata:
name: argocd-notifications-secret
stringData:
notifiers.yaml: |
slack:
token: <my-token>
type: Opaque
EOF
```
* Enable built-in trigger in the `argocd-notifications-cm` config map:
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/release-v1.0/catalog/install.yaml
```

* Configure Slack integration

```bash
kubectl apply -n argocd -f - << EOF
Expand All @@ -38,20 +29,29 @@ kind: ConfigMap
metadata:
name: argocd-notifications-cm
data:
config.yaml: |
triggers:
- name: on-sync-succeeded
enabled: true
service.slack: |
token: $slack-token
EOF
```

* Subscribe to notifications by adding the `recipients.argocd-notifications.argoproj.io` annotation to the Argo CD application or project :
* Add Slack token to `argocd-notifications-secret` secret

```bash
kubectl patch app <my-app> -n argocd -p '{"metadata": {"annotations": {"recipients.argocd-notifications.argoproj.io":"slack:<my-channel>"}}}' --type merge
kubectl apply -n argocd -f - << EOF
apiVersion: v1
kind: Secret
metadata:
name: argocd-notifications-secret
stringData:
slack-token: <my-slack-token>
type: Opaque
EOF
```

* Subscribe to notifications by adding the `notifications.argoproj.io/subscribe.on-sync-succeeded.slack` annotation to the Argo CD application or project:

```bash
kubectl patch appproject <project-name> -n argocd -p '{"metadata": {"annotations": {"recipients.argocd-notifications.argoproj.io":"slack:<my-channel>"}}}' --type merge
kubectl patch app <my-app> -n argocd -p '{"metadata": {"annotations": {"notifications.argoproj.io/subscribe.on-sync-succeeded.slack":"<my-channel>"}}}' --type merge
```

Try syncing and application and get the notification once sync is completed.
Expand Down
86 changes: 0 additions & 86 deletions docs/recipients/overview.md

This file was deleted.

8 changes: 4 additions & 4 deletions docs/services/grafana.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ To be able to create Grafana annotation with argocd-notifications you have to cr
3. Click "Add API Key"
4. Fill the Key with name `ArgoCD Notification`, role `Editor` and Time to Live `10y` (for example)
5. Click on Add button
6. Copy your API Key and define it in `notifiers.yaml`
6. Copy your API Key and define it in `argocd-notifications-cm` ConfigMap

```yaml
apiVersion: v1
kind: Secret
kind: ConfigMap
metadata:
name: argocd-notifications-secret
stringData:
name: argocd-notifications-cm
data:
service.grafana: |
apiUrl: https://grafana.example.com/api
apiKey: <grafana-api-key>
Expand Down
7 changes: 4 additions & 3 deletions docs/services/opsgenie.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ To be able to send notifications with argocd-notifications you have to create an
10. Click "Safe Integration" at the bottom
11. Check your browser for the correct server apiURL. If it is "app.opsgenie.com" then use the us/international api url `api.opsgenie.com` in the next step, otherwise use `api.eu.opsgenie.com` (european api).
12. You are finished with configuring opsgenie. Now you need to configure argocd-notifications. Use the apiUrl, the team name and the apiKey to configure the opsgenie integration in the `argocd-notifications-secret` secret.

```yaml
apiVersion: v1
kind: Secret
kind: ConfigMap
metadata:
name: argocd-notifications-secret
stringData:
name: argocd-notifications-cm
data:
service.opsgenie: |
apiUrl: <api-url>
apiKeys:
Expand Down
37 changes: 34 additions & 3 deletions docs/services/overview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
## Notification Services
The notification services represent integration with services such as slack, email or custom webhook. Services are configured in `argocd-notifications-cm` ConfigMap
using `service.<type>.(<optiona-name>)` keys and might referense sensitive data from `argocd-notifications-secret` Secret. Following example demonstrates slack
service configuration:

The notification services are configured in the `notifiers.yaml` field of the `argocd-notifications-secret.yaml` Secret:
```yaml
service.slack: |
token: $slack-token
```
The `slack` indicates that service sends slack notification; name is missing and defaults to `slack`.

## Sensitive Data

Sensitive data like authentication tokens should be stored in `argocd-notifications-secret` Secret and can be referenced in
service configuration using `$<secret-key>` format. For example `$slack-token` referencing value of key `slack-token` in
`argocd-notifications-secret` Secret.

## Custom Names

Service custom names allow configuring two instances of the same service type. For example, in addition to slack, you might register slack compatible service
that leverages [Mattermost](https://mattermost.com/):

```yaml
{!argocd-notifications-secret.yaml!}
# Slack based notifier with name mattermost
service.slack.mattermost: |
apiURL: https://my-mattermost-url.com/api
token: $slack-token
```

## Service Types

* [Slack](./slack.md)
* [Opsgenie](./opsgenie.md)
* [Grafana](./grafana.md)
* [Webhook](./webhook.md)
* [Telegram](./telegram.md)

Loading

0 comments on commit 7fcd527

Please sign in to comment.