Compare commits

...
Author SHA1 Message Date
Kilian BouteandClaude Opus 5.5 f7bc305d93 feat(hub): email.customTemplates mounted at /mail/templates (0.205.0)
Each deployment can carry its own email templates in its values:
email.customTemplates maps <template>.html / <template>.txt to content.
The chart renders them into the hub-email-templates ConfigMap and mounts
it read-only at /mail/templates on hub-api, pipe-notify and
hub-monitor-device, where each file replaces the service's built-in
template of that name. Other file names fail the render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:25:09 +00:00
7 changed files with 67 additions and 8 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.203.0
version: 0.205.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
+2 -1
View File
@@ -1320,6 +1320,7 @@ kerberospipeline:
| `email.templates.deviceGroupTitle` | Email subject title for the `device_group` template. | `"[Device] Several cameras changed status"` |
| `email.templates.recording` | The template for recording check alerts (a continuously recording camera that is online but uploads no recordings, and again when it records). Empty uses `recording` with SMTP; for SendGrid or Mailgun set the template id, otherwise they use `device`. See *Camera recordings* below. | `""` |
| `email.templates.recordingTitle` | Email subject for recording check alerts. Empty uses "[Device] A camera stopped recording", "[Device] A camera is recording again" and their forms for several cameras. | `""` |
| `email.customTemplates` | Email templates of this deployment, by file name (`<template>.html` / `<template>.txt`). Mounted read-only at `/mail/templates` on hub-api, pipe-notify and hub-monitor-device from the `hub-email-templates` ConfigMap; each replaces the built-in template with the same name when sending with SMTP. Other file names fail the render. | `{}` |
| `email.mailgun.apiKey` | The Mailgun API key linked to your Mailgun domain. | `""` |
| `imagePullSecrets.name` | Docker registry secret name, which is also granted with the license. This allows you to download the Docker images. | `""` |
| `kerberoshub.frontend.ssoDomain` | The domain that's being used to activate SSO from the login page. | `""` |
@@ -1332,7 +1333,7 @@ Every email Hub sends is a template: an HTML file, plus a plain-text `.txt` vers
#### Which template is used
- `email.templates.<name>` sets the template name for each email (for example `email.templates.detection: "detection"`).
- With `email.provider: smtp`, Hub reads `/mail/templates/<name>.html` and `/mail/templates/<name>.txt` from the container. If the files are not there, it uses its built-in template with that name. To use your own, mount a volume at `/mail` (see the commented `custom-email-templates` volume in `values.yaml`). The [`custom-layout/templates`](custom-layout/templates) folder holds a complete set to start from.
- With `email.provider: smtp`, Hub reads `/mail/templates/<name>.html` and `/mail/templates/<name>.txt` from the container. If the files are not there, it uses its built-in template with that name. Each service has built-in templates for the emails it sends: hub-api for welcome, activate, forgot, share, share_case, share_case_otp, assign_task and invitation; pipe-notify for detection; hub-monitor-device for device, device_group and recording. To use your own, set them in `email.customTemplates` (file name → content). The chart puts them in the `hub-email-templates` ConfigMap and mounts it read-only at `/mail/templates` on those three services. A volume mounted at `/mail` (the commented `custom-email-templates` volume in `values.yaml`) still works when `email.customTemplates` is empty. The [`custom-layout/templates`](custom-layout/templates) folder holds a complete set to start from.
- With `email.provider: mailgun`, `<name>` is a template stored in your Mailgun account. Mailgun receives `user`, `text`, `link`, `numberOfMedia`, `dataUsage` and the email-specific values below as template variables. The computed values (dates, camera, sites, groups, thumbnail) are only filled in with `smtp`.
- Alert emails (`detection`) are only sent when `email.provider` is `smtp`.
- A placeholder that has no value for that email stays in the email as literal text, so only use the placeholders listed for it. The bundled templates contain `{{tab1_href}}`, `{{tab1_title}}`, `{{tab2_href}}` and `{{tab2_title}}`; these are not filled in.
@@ -0,0 +1,17 @@
{{- with .Values.email.customTemplates }}
apiVersion: v1
kind: ConfigMap
metadata:
name: hub-email-templates
namespace: {{ $.Release.Namespace }}
data:
# email.customTemplates, mounted at /mail/templates on hub-api, pipe-notify
# and hub-monitor-device. Each file replaces the built-in template with the
# same name when the services send with SMTP.
{{- range $file, $content := . }}
{{- if not (regexMatch "^[a-z0-9_]+\\.(html|txt)$" $file) }}
{{- fail (printf "email.customTemplates: %q must be named <template>.html or <template>.txt" $file) }}
{{- end }}
{{ $file }}: {{ $content | quote }}
{{- end }}
{{- end }}
+12 -2
View File
@@ -158,7 +158,7 @@ spec:
{{- $mongodbTLS := .Values.mongodb.tls }}
{{- $classificationCatalogEnabled := .Values.classificationCatalogEnabled }}
{{- $deviceSystemTagsEnabled := include "kerberoshub.deviceTags.system.enabled" . }}
{{- if or $workflowConfiguration.enabled $classificationCatalogEnabled $deviceSystemTagsEnabled .Values.subscriptions.plans.enabled .Values.kerberoshub.api.volumes (and $serverTLS.enabled $serverTLS.secretName) (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
{{- if or $workflowConfiguration.enabled $classificationCatalogEnabled $deviceSystemTagsEnabled .Values.subscriptions.plans.enabled .Values.email.customTemplates .Values.kerberoshub.api.volumes (and $serverTLS.enabled $serverTLS.secretName) (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
volumes:
{{- if $workflowConfiguration.enabled }}
- name: workflow-configuration
@@ -221,6 +221,11 @@ spec:
configMap:
name: hub-plans
{{- end }}
{{- if .Values.email.customTemplates }}
- name: email-templates
configMap:
name: hub-email-templates
{{- end }}
{{- with .Values.kerberoshub.api.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
@@ -252,7 +257,7 @@ spec:
ports:
- containerPort: 80
name: http
{{- if or $workflowConfiguration.enabled $classificationCatalogEnabled $deviceSystemTagsEnabled .Values.subscriptions.plans.enabled .Values.kerberoshub.api.volumeMounts (and $serverTLS.enabled $serverTLS.secretName) (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
{{- if or $workflowConfiguration.enabled $classificationCatalogEnabled $deviceSystemTagsEnabled .Values.subscriptions.plans.enabled .Values.email.customTemplates .Values.kerberoshub.api.volumeMounts (and $serverTLS.enabled $serverTLS.secretName) (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
volumeMounts:
{{- if $workflowConfiguration.enabled }}
- name: workflow-configuration
@@ -274,6 +279,11 @@ spec:
mountPath: /etc/kerberos/plans
readOnly: true
{{- end }}
{{- if .Values.email.customTemplates }}
- name: email-templates
mountPath: /mail/templates
readOnly: true
{{- end }}
{{- with .Values.kerberoshub.api.volumeMounts}}
{{- toYaml . | nindent 12 }}
{{- end }}
@@ -34,8 +34,13 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- $mongodbTLS := .Values.mongodb.tls }}
{{- if or .Values.kerberoshub.monitordevice.volumes (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
{{- if or .Values.kerberoshub.monitordevice.volumes .Values.email.customTemplates (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
volumes:
{{- if .Values.email.customTemplates }}
- name: email-templates
configMap:
name: hub-email-templates
{{- end }}
{{- with .Values.kerberoshub.monitordevice.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
@@ -65,8 +70,13 @@ spec:
containerPort: 8080
protocol: TCP
{{- end }}
{{- if or .Values.kerberoshub.monitordevice.volumeMounts (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
{{- if or .Values.kerberoshub.monitordevice.volumeMounts .Values.email.customTemplates (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
volumeMounts:
{{- if .Values.email.customTemplates }}
- name: email-templates
mountPath: /mail/templates
readOnly: true
{{- end }}
{{- with .Values.kerberoshub.monitordevice.volumeMounts}}
{{- toYaml . | nindent 12 }}
{{- end }}
@@ -38,8 +38,13 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- $mongodbTLS := .Values.mongodb.tls }}
{{- if or .Values.kerberospipeline.notify.volumes (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
{{- if or .Values.kerberospipeline.notify.volumes .Values.email.customTemplates (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
volumes:
{{- if .Values.email.customTemplates }}
- name: email-templates
configMap:
name: hub-email-templates
{{- end }}
{{- with .Values.kerberospipeline.notify.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
@@ -63,8 +68,13 @@ spec:
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if or .Values.kerberospipeline.notify.volumeMounts (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
{{- if or .Values.kerberospipeline.notify.volumeMounts .Values.email.customTemplates (and $mongodbTLS.enabled $mongodbTLS.existingSecret) }}
volumeMounts:
{{- if .Values.email.customTemplates }}
- name: email-templates
mountPath: /mail/templates
readOnly: true
{{- end }}
{{- with .Values.kerberospipeline.notify.volumeMounts}}
{{- toYaml . | nindent 12 }}
{{- end }}
+11
View File
@@ -1737,3 +1737,14 @@ email:
# Empty uses "[Device] A camera stopped recording", "[Device] A camera is
# recording again" and their forms for several cameras.
recordingTitle: ""
# Email templates of this deployment, by file name: <template>.html and
# <template>.txt, for example detection.html. They are mounted at
# /mail/templates on hub-api, pipe-notify and hub-monitor-device, and each
# replaces the built-in template with the same name when sending with SMTP.
# Templates not listed keep the built-in version. Start from
# custom-layout/templates.
customTemplates: {}
# detection.html: |
# <html>...{{text}}...{{link}}...</html>
# detection.txt: |
# {{text}} {{link}}