-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnotifications.cue
73 lines (68 loc) · 1.44 KB
/
notifications.cue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package tenant
import (
corev1 "k8s.io/api/core/v1"
fluxv1 "github.com/fluxcd/notification-controller/api/v1beta1"
)
#SlackAlert: fluxv1.#Alert & {
_spec: #TenantSpec
apiVersion: "notification.toolkit.fluxcd.io/v1beta1"
kind: "Alert"
metadata: {
name: "slack-\(_spec.name)"
namespace: _spec.namespace
labels: _spec.labels
annotations: _spec.annotations
}
spec: {
eventSeverity: "info"
providerRef: name: "slack-\(_spec.name)"
eventSources: [
{
kind: "GitRepository"
name: "*"
},
{
kind: "Kustomization"
name: "*"
},
{
kind: "HelmRelease"
name: "*"
},
]
if _spec.slack.cluster != "" {
summary: "cluster \(_spec.slack.cluster)"
}
}
}
#SlackProvider: fluxv1.#Provider & {
_spec: #TenantSpec
apiVersion: "notification.toolkit.fluxcd.io/v1beta1"
kind: "Provider"
metadata: {
name: "slack-\(_spec.name)"
namespace: _spec.namespace
labels: _spec.labels
annotations: _spec.annotations
}
spec: {
type: "slack"
channel: _spec.slack.channel
secretRef: name: "slack-\(_spec.name)"
}
}
#SlackSecret: corev1.#Secret & {
_spec: #TenantSpec
apiVersion: "v1"
kind: "Secret"
metadata: {
name: "slack-\(_spec.name)"
namespace: _spec.namespace
labels: _spec.labels
annotations: _spec.annotations
}
stringData: {
address: "https://slack.com/api/chat.postMessage"
token: _spec.slack.token
}
}