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

Commit 059c1b6

Browse files
fix: update argocd version (#370)
* update argocd version * update argocd version
1 parent 18892b7 commit 059c1b6

File tree

5 files changed

+745
-185
lines changed

5 files changed

+745
-185
lines changed

docs/services/alertmanager.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Alertmanager
2+
3+
## Parameters
4+
5+
The notification service is used to push events to [Alertmanager](https://github.com/prometheus/alertmanager), and the following settings need to be specified:
6+
7+
* `targets` - the alertmanager service address, array type
8+
* `scheme` - optional, default is "http", e.g. http or https
9+
* `apiPath` - optional, default is "/api/v2/alerts"
10+
* `insecureSkipVerify` - optional, default is "false", when scheme is https whether to skip the verification of ca
11+
* `basicAuth` - optional, server auth
12+
* `bearerToken` - optional, server auth
13+
* `timeout` - optional, the timeout in seconds used when sending alerts, default is "3 seconds"
14+
15+
`basicAuth` or `bearerToken` is used for authentication, you can choose one. If the two are set at the same time, `basicAuth` takes precedence over `bearerToken`.
16+
17+
## Example
18+
19+
### Prometheus Alertmanager config
20+
21+
```yaml
22+
global:
23+
resolve_timeout: 5m
24+
25+
route:
26+
group_by: ['alertname']
27+
group_wait: 10s
28+
group_interval: 10s
29+
repeat_interval: 1h
30+
receiver: 'default'
31+
receivers:
32+
- name: 'default'
33+
webhook_configs:
34+
- send_resolved: false
35+
url: 'http://10.5.39.39:10080/api/alerts/webhook'
36+
```
37+
38+
You should turn off "send_resolved" or you will receive unnecessary recovery notifications after "resolve_timeout".
39+
40+
### Send one alertmanager without auth
41+
42+
```yaml
43+
apiVersion: v1
44+
kind: ConfigMap
45+
metadata:
46+
name: <config-map-name>
47+
data:
48+
service.alertmanager: |
49+
targets:
50+
- 10.5.39.39:9093
51+
```
52+
53+
### Send alertmanager cluster with custom api path
54+
55+
If your alertmanager has changed the default api, you can customize "apiPath".
56+
57+
```yaml
58+
apiVersion: v1
59+
kind: ConfigMap
60+
metadata:
61+
name: <config-map-name>
62+
data:
63+
service.alertmanager: |
64+
targets:
65+
- 10.5.39.39:443
66+
scheme: https
67+
apiPath: /api/events
68+
insecureSkipVerify: true
69+
```
70+
71+
### Send high availability alertmanager with auth
72+
73+
Store auth token in `argocd-notifications-secret` Secret and use configure in `argocd-notifications-cm` ConfigMap.
74+
75+
```yaml
76+
apiVersion: v1
77+
kind: Secret
78+
metadata:
79+
name: <secret-name>
80+
stringData:
81+
alertmanager-username: <username>
82+
alertmanager-password: <password>
83+
alertmanager-bearer-token: <token>
84+
```
85+
86+
- with basicAuth
87+
88+
```yaml
89+
apiVersion: v1
90+
kind: ConfigMap
91+
metadata:
92+
name: <config-map-name>
93+
data:
94+
service.alertmanager: |
95+
targets:
96+
- 10.5.39.39:19093
97+
- 10.5.39.39:29093
98+
- 10.5.39.39:39093
99+
scheme: https
100+
apiPath: /api/v2/alerts
101+
insecureSkipVerify: true
102+
basicAuth:
103+
username: $alertmanager-username
104+
password: $alertmanager-password
105+
```
106+
107+
- with bearerToken
108+
109+
```yaml
110+
apiVersion: v1
111+
kind: ConfigMap
112+
metadata:
113+
name: <config-map-name>
114+
data:
115+
service.alertmanager: |
116+
targets:
117+
- 10.5.39.39:19093
118+
- 10.5.39.39:29093
119+
- 10.5.39.39:39093
120+
scheme: https
121+
apiPath: /api/v2/alerts
122+
insecureSkipVerify: true
123+
bearerToken: $alertmanager-bearer-token
124+
```
125+
126+
## Templates
127+
128+
* `labels` - at least one label pair required, implement different notification strategies according to alertmanager routing
129+
* `annotations` - optional, specifies a set of information labels, which can be used to store longer additional information, but only for display
130+
* `generatorURL` - optional, default is '{{.app.spec.source.repoURL}}', backlink used to identify the entity that caused this alert in the client
131+
132+
the `label` or `annotations` or `generatorURL` values can be templated.
133+
134+
```yaml
135+
context: |
136+
argocdUrl: https://example.com/argocd
137+
138+
template.app-deployed: |
139+
message: Application {{.app.metadata.name}} has been healthy.
140+
alertmanager:
141+
labels:
142+
fault_priority: "P5"
143+
event_bucket: "deploy"
144+
event_status: "succeed"
145+
recipient: "{{.recipient}}"
146+
annotations:
147+
application: '<a href="{{.context.argocdUrl}}/applications/{{.app.metadata.name}}">{{.app.metadata.name}}</a>'
148+
author: "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Author}}"
149+
message: "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Message}}"
150+
```
151+
152+
You can do targeted push on [Alertmanager](https://github.com/prometheus/alertmanager) according to labels.
153+
154+
```yaml
155+
template.app-deployed: |
156+
message: Application {{.app.metadata.name}} has been healthy.
157+
alertmanager:
158+
labels:
159+
alertname: app-deployed
160+
fault_priority: "P5"
161+
event_bucket: "deploy"
162+
```
163+
164+
There is a special label `alertname`. If you don’t set its value, it will be equal to the template name by default.

docs/services/googlechat.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Google Chat
2+
3+
## Parameters
4+
5+
The Google Chat notification service send message notifications to a google chat webhook. This service uses the following settings:
6+
7+
* `webhooks` - a map of the form `webhookName: webhookUrl`
8+
9+
## Configuration
10+
11+
1. Open `Google chat` and go to the space to which you want to send messages
12+
2. From the menu at the top of the page, select **Configure Webhooks**
13+
3. Under **Incoming Webhooks**, click **Add Webhook**
14+
4. Give a name to the webhook, optionally add an image and click **Save**
15+
5. Copy the URL next to your webhook
16+
6. Store the URL in `argocd-notification-secret` and declare it in `argocd-notifications-cm`
17+
18+
```yaml
19+
apiVersion: v1
20+
kind: ConfigMap
21+
metadata:
22+
name: <config-map-name>
23+
data:
24+
service.googlechat: |
25+
webhooks:
26+
spaceName: $space-webhook-url
27+
```
28+
29+
```yaml
30+
apiVersion: v1
31+
kind: Secret
32+
metadata:
33+
name: <secret-name>
34+
stringData:
35+
space-webhook-url: https://chat.googleapis.com/v1/spaces/<space_id>/messages?key=<key>&token=<token>
36+
```
37+
38+
6. Create a subscription for your space
39+
40+
```yaml
41+
apiVersion: argoproj.io/v1alpha1
42+
kind: Application
43+
metadata:
44+
annotations:
45+
notifications.argoproj.io/subscribe.on-sync-succeeded.googlechat: spaceName
46+
```
47+
48+
## Templates
49+
50+
You can send [simple text](https://developers.google.com/chat/reference/message-formats/basic) or [card messages](https://developers.google.com/chat/reference/message-formats/cards) to a Google Chat space. A simple text message template can be defined as follows:
51+
52+
```yaml
53+
template.app-sync-succeeded: |
54+
message: The app {{ .app.metadata.name }} has succesfully synced!
55+
```
56+
57+
A card message can be defined as follows:
58+
59+
```yaml
60+
template.app-sync-succeeded: |
61+
googlechat:
62+
cards: |
63+
- header:
64+
title: ArgoCD Bot Notification
65+
sections:
66+
- widgets:
67+
- textParagraph:
68+
text: The app {{ .app.metadata.name }} has succesfully synced!
69+
- widgets:
70+
- keyValue:
71+
topLabel: Repository
72+
content: {{ call .repo.RepoURLToHTTPS .app.spec.source.repoURL }}
73+
- keyValue:
74+
topLabel: Revision
75+
content: {{ .app.spec.source.targetRevision }}
76+
- keyValue:
77+
topLabel: Author
78+
content: {{ (call .repo.GetCommitMetadata .app.status.sync.revision).Author }}
79+
```
80+
81+
The card message can be written in JSON too.

docs/services/pushover.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Pushover
2+
3+
1. Create an app at [pushover.net](https://pushover.net/apps/build).
4+
2. Store the API key in `<secret-name>` Secret and define the secret name in `<config-map-name>` ConfigMap:
5+
6+
```yaml
7+
apiVersion: v1
8+
kind: ConfigMap
9+
metadata:
10+
name: <config-map-name>
11+
data:
12+
service.pushover: |
13+
token: $pushover-token
14+
```
15+
16+
```yaml
17+
apiVersion: v1
18+
kind: Secret
19+
metadata:
20+
name: <secret-name>
21+
stringData:
22+
pushover-token: avtc41pn13asmra6zaiyf7dh6cgx97
23+
```
24+
25+
3. Add your user key to your Application resource:
26+
27+
```yaml
28+
apiVersion: argoproj.io/v1alpha1
29+
kind: Application
30+
metadata:
31+
annotations:
32+
notifications.argoproj.io/subscribe.on-sync-succeeded.pushover: uumy8u4owy7bgkapp6mc5mvhfsvpcd
33+
```

go.mod

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,55 @@ module github.com/argoproj-labs/argocd-notifications
33
go 1.16
44

55
require (
6-
github.com/argoproj/argo-cd/v2 v2.0.0-rc3
6+
github.com/argoproj/argo-cd/v2 v2.1.7
77
github.com/argoproj/notifications-engine v0.3.1-0.20211117165611-0e1f1eda5f52
8-
github.com/evanphx/json-patch v4.9.0+incompatible
8+
github.com/evanphx/json-patch v4.11.0+incompatible
99
github.com/ghodss/yaml v1.0.0
10+
github.com/go-redis/cache/v8 v8.11.3 // indirect
1011
github.com/golang/mock v1.5.0
1112
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 // indirect
1213
github.com/olekukonko/tablewriter v0.0.4
13-
github.com/prometheus/client_golang v1.7.1
14+
github.com/prometheus/client_golang v1.11.0
1415
github.com/robfig/cron v1.2.0 // indirect
15-
github.com/sirupsen/logrus v1.6.0
16+
github.com/sirupsen/logrus v1.8.1
1617
github.com/slack-go/slack v0.6.6
1718
github.com/spf13/cobra v1.1.3
18-
github.com/stretchr/testify v1.6.1
19+
github.com/stretchr/testify v1.7.0
1920
github.com/whilp/git-urls v0.0.0-20191001220047-6db9661140c0
20-
k8s.io/api v0.20.4
21-
k8s.io/apimachinery v0.20.4
21+
k8s.io/api v0.21.0
22+
k8s.io/apimachinery v0.21.0
2223
k8s.io/client-go v11.0.1-0.20190816222228-6d55c1b1f1ca+incompatible
23-
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
24+
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
2425
)
2526

2627
replace (
2728
// https://github.com/golang/go/issues/33546#issuecomment-519656923
2829
github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
2930

30-
k8s.io/api => k8s.io/api v0.20.4
31-
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.4
32-
k8s.io/apimachinery => k8s.io/apimachinery v0.20.4
33-
k8s.io/apiserver => k8s.io/apiserver v0.20.4
34-
k8s.io/cli-runtime => k8s.io/cli-runtime v0.20.4
35-
k8s.io/client-go => k8s.io/client-go v0.20.4
36-
k8s.io/cloud-provider => k8s.io/cloud-provider v0.20.4
37-
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.20.4
38-
k8s.io/code-generator => k8s.io/code-generator v0.20.4
39-
k8s.io/component-base => k8s.io/component-base v0.20.4
40-
k8s.io/component-helpers => k8s.io/component-helpers v0.20.4
41-
k8s.io/controller-manager => k8s.io/controller-manager v0.20.4
42-
k8s.io/cri-api => k8s.io/cri-api v0.20.4
43-
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.20.4
44-
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.20.4
45-
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.20.4
46-
k8s.io/kube-proxy => k8s.io/kube-proxy v0.20.4
47-
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.20.4
48-
k8s.io/kubectl => k8s.io/kubectl v0.20.4
49-
k8s.io/kubelet => k8s.io/kubelet v0.20.4
50-
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.20.4
51-
k8s.io/metrics => k8s.io/metrics v0.20.4
52-
k8s.io/mount-utils => k8s.io/mount-utils v0.20.4
53-
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.20.4
31+
github.com/go-redis/cache/v8 => github.com/go-redis/cache/v8 v8.4.3
32+
33+
k8s.io/api => k8s.io/api v0.21.0
34+
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.0
35+
k8s.io/apimachinery => k8s.io/apimachinery v0.21.0
36+
k8s.io/apiserver => k8s.io/apiserver v0.21.0
37+
k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.0
38+
k8s.io/client-go => k8s.io/client-go v0.21.0
39+
k8s.io/cloud-provider => k8s.io/cloud-provider v0.21.0
40+
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.0
41+
k8s.io/code-generator => k8s.io/code-generator v0.21.0
42+
k8s.io/component-base => k8s.io/component-base v0.21.0
43+
k8s.io/component-helpers => k8s.io/component-helpers v0.21.0
44+
k8s.io/controller-manager => k8s.io/controller-manager v0.21.0
45+
k8s.io/cri-api => k8s.io/cri-api v0.21.0
46+
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.0
47+
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.0
48+
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.21.0
49+
k8s.io/kube-proxy => k8s.io/kube-proxy v0.21.0
50+
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.21.0
51+
k8s.io/kubectl => k8s.io/kubectl v0.21.0
52+
k8s.io/kubelet => k8s.io/kubelet v0.21.0
53+
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.21.0
54+
k8s.io/metrics => k8s.io/metrics v0.21.0
55+
k8s.io/mount-utils => k8s.io/mount-utils v0.21.0
56+
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.0
5457
)

0 commit comments

Comments
 (0)