Notification template

Shows how to create a notification template.

---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaNotificationTemplate
metadata:
  name: notificationtemplate-sample
spec:
  instanceSelector:
    matchLabels:
      dashboards: "grafana"
  name: notificationtemplate-sample
  editable: false
  template: |
    {{ define "SlackAlert" }}
      [{{.Status}}] {{ .Labels.alertname }}
      {{ .Annotations.AlertValues }}
    {{ end }}

    {{ define "SlackAlertMessage" }}
      {{ if gt (len .Alerts.Firing) 0 }}
        {{ len .Alerts.Firing }} firing:
        {{ range .Alerts.Firing }} {{ template "SlackAlert" . }} {{ end }}
      {{ end }}
      {{ if gt (len .Alerts.Resolved) 0 }}
        {{ len .Alerts.Resolved }} resolved:
        {{ range .Alerts.Resolved }} {{ template "SlackAlert" . }} {{ end }}
      {{ end }}
    {{ end }}    
Last modified January 15, 2025: chore: prep for release 5.16.0 (#1823) (cef6a54)