Skip to content

Commit 61c1ff3

Browse files
committed
docs(ContactPoint): Update examples and show multiple receivers
1 parent 91b8da1 commit 61c1ff3

File tree

3 files changed

+56
-17
lines changed

3 files changed

+56
-17
lines changed

examples/contact_point/_index.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@ tags:
99
Contact points contain the configuration for sending alert notifications. You can assign a contact point either in the alert rule or notification policy options.
1010
For a complete explanation on notification policies, refer to the [upstream Grafana documentation](https://grafana.com/docs/grafana/latest/alerting/fundamentals/notifications/contact-points/).
1111

12-
{{% alert title="Note" color="secondary" %}}
13-
The Grafana operator currently only supports a single receiver per contact point definition.
14-
As a workaround you can create multiple contact points with the same `spec.name` value.
15-
Follow issue [#1529](https://github.com/grafana/grafana-operator/issues/1529) for further updates on this topic.
16-
{{% /alert %}}
17-
1812
The following snippet shows an example contact point which notifies a specific email address.
1913
It also highlights how secrets and config maps can utilized to externalize some of the configuration.
2014
This is especially useful for contact points which contain sensitive information.
2115

2216
To view the entire configuration that you can do within Contact-Points, look at our [API documentation](/docs/api/#grafanacontactpointspec).
2317

2418
{{< readfile file="./resources.yaml" code="true" lang="yaml" >}}
19+
20+
### Deprecated Single receiver format
21+
22+
`GrafanaContactPoint` did not support multiple receivers prior to `v5.21.0`.
23+
24+
The old, format is now deprecated but is still supported.
25+
26+
The fields `.spec.type`, `.spec.settings`, and `.spec.valuesFrom` are entirely ignored when `.spec.recievers[...]` is configured, but the below configuration is still valid otherwise.
27+
28+
This ensures full backwards compatibility before releasing a new crd `apiVersion` without the deprecated fields.
29+
30+
{{< readfile file="./previous-format.yaml" code="true" lang="yaml" >}}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
apiVersion: grafana.integreatly.org/v1beta1
3+
kind: GrafanaContactPoint
4+
metadata:
5+
name: old-format
6+
spec:
7+
name: required
8+
instanceSelector:
9+
matchLabels:
10+
instance: my-grafana-stack
11+
type: "email"
12+
settings:
13+
subject: 'Grafana Alert'
14+
valuesFrom:
15+
- targetPath: addresses
16+
valueFrom:
17+
secretKeyRef:
18+
name: contacts
19+
key: alert-mails
Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
apiVersion: v1
22
kind: Secret
33
metadata:
4-
name: contact-mails
4+
name: contacts
55
stringData:
66
alert-mails: "foo@example.com"
7+
alert-hook: "webhook.example.invalid"
78
---
89
apiVersion: grafana.integreatly.org/v1beta1
910
kind: GrafanaContactPoint
1011
metadata:
1112
name: grafanacontactpoint-sample
1213
spec:
13-
name: grafanacontactpoint-sample
14-
type: "email"
14+
name: Optional Name
1515
instanceSelector:
1616
matchLabels:
1717
instance: my-grafana-stack
18-
settings:
19-
subject: 'Grafana Alert'
20-
valuesFrom:
21-
- targetPath: addresses
22-
valueFrom:
23-
secretKeyRef:
24-
name: contact-mails
25-
key: alert-mails
18+
# ContactPoints are uneditable by default.
19+
# Additionally, editable is immutable and can only be set at creation by the operator.
20+
editable: true
21+
receivers:
22+
- type: email
23+
settings:
24+
subject: Grafana Alert
25+
valuesFrom:
26+
- targetPath: addresses
27+
valueFrom:
28+
secretKeyRef:
29+
name: contacts
30+
key: alert-mails
31+
- type: webhook
32+
settings:
33+
title: Grafana Alert
34+
valuesFrom:
35+
- targetPath: url
36+
valueFrom:
37+
secretKeyRef:
38+
name: contacts
39+
key: alert-hook

0 commit comments

Comments
 (0)