Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions examples/contact_point/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ tags:
Contact points contain the configuration for sending alert notifications. You can assign a contact point either in the alert rule or notification policy options.
For a complete explanation on notification policies, refer to the [upstream Grafana documentation](https://grafana.com/docs/grafana/latest/alerting/fundamentals/notifications/contact-points/).

{{% alert title="Note" color="secondary" %}}
The Grafana operator currently only supports a single receiver per contact point definition.
As a workaround you can create multiple contact points with the same `spec.name` value.
Follow issue [#1529](https://github.com/grafana/grafana-operator/issues/1529) for further updates on this topic.
{{% /alert %}}

The following snippet shows an example contact point which notifies a specific email address.
The following snippet shows an example contact point which notifies a specific email address and a webhook endpoint.
It also highlights how secrets and config maps can utilized to externalize some of the configuration.
This is especially useful for contact points which contain sensitive information.

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

{{< readfile file="./resources.yaml" code="true" lang="yaml" >}}

### Deprecated Single receiver format

`GrafanaContactPoint` did not support multiple receivers prior to `v5.21.0`.

The previous format is now deprecated, but is still supported.

The fields `.spec.type`, `.spec.settings`, and `.spec.valuesFrom` are entirely ignored when `.spec.recievers[...]` is configured, but the below configuration is still valid for the duration of `v1beta1`.

This means full backwards compatibility during transitions to the receivers field.

{{< readfile file="./previous-format.yaml" code="true" lang="yaml" >}}
19 changes: 19 additions & 0 deletions examples/contact_point/previous-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaContactPoint
metadata:
name: previous-format
spec:
name: required
instanceSelector:
matchLabels:
instance: my-grafana-stack
type: "email"
settings:
subject: 'Grafana Alert'
valuesFrom:
- targetPath: addresses
valueFrom:
secretKeyRef:
name: contacts
key: alert-mails
35 changes: 24 additions & 11 deletions examples/contact_point/resources.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
apiVersion: v1
kind: Secret
metadata:
name: contact-mails
name: contacts
stringData:
alert-mails: "foo@example.com"
alert-hook: "webhook.example.invalid"
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaContactPoint
metadata:
name: grafanacontactpoint-sample
spec:
name: grafanacontactpoint-sample
type: "email"
name: Optional Name
instanceSelector:
matchLabels:
instance: my-grafana-stack
settings:
subject: 'Grafana Alert'
valuesFrom:
- targetPath: addresses
valueFrom:
secretKeyRef:
name: contact-mails
key: alert-mails
# Editing ContactPoints in the UI is disabled by default
editable: true # editable is immutable and can only be set at creation
receivers:
- type: email
settings:
subject: Grafana Alert
valuesFrom:
- targetPath: addresses
valueFrom:
secretKeyRef:
name: contacts
key: alert-mails
- type: webhook
settings:
title: Grafana Alert
valuesFrom:
- targetPath: url
valueFrom:
secretKeyRef:
name: contacts
key: alert-hook
Loading