[Supported since Kublr KCP 1.22.1]
In Kublr 1.22.1 support is introduced for configuring Alertmanager email templates via Kublr cluster specification.
Create custom email template
Create file customemail.tmpl with content like
{{ define "email.default.subject" }}{{ template "__subject" . }}{{ end }}
{{ define "SOME_DEFINED_NAME" }}
... Here is your email template ...Add custom html template as ConfigMap
The next step is to use kubectl to add your custom template as ConfigMap to Kublr namespace:
kubectl create configmap -n kublr email-custom-template --from-file=./customemail.tmpl
Modify cluster spec
The last step is to modify cluster specification (see exmaple below) and push Validate and Update button.
values:
alertmanager:
config:
default_receiver: email
extraTemplatesConfigmaps:
- fileMask: '*.tmpl'
name: email-custom-template
receivers: |
- name: email
email_configs:
- to: to_email@example.com
from: from_email@example.com
smarthost: SMTP_HOST_ADDRESS
auth_username: SMTP_LOGIN
auth_identity: SMTP_IDENTITY
auth_password: SMTP_PASSWORD
html: '{{ template "SOME_DEFINED_NAME" . }}'Multiple template files may be added in a ConfigMap (with different file names) as well as multiple ConfigMaps can be used.