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
4 changes: 2 additions & 2 deletions charts/mailpit/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: mailpit
description: An email and SMTP testing tool with API for developers
icon: https://raw.githubusercontent.com/axllent/mailpit/develop/server/ui/mailpit.svg
type: application
version: 0.36.1
appVersion: 1.29.6
version: 0.37.0
appVersion: 1.31.1
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
Expand Down
93 changes: 49 additions & 44 deletions charts/mailpit/README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions charts/mailpit/ci/tls-auto-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mailpit:
smtp:
tls:
enabled: true
method: auto
auto:
dnsNames:
- smtp.example.com
12 changes: 12 additions & 0 deletions charts/mailpit/ci/tls-cert-manager-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mailpit:
smtp:
tls:
enabled: true
method: cert-manager
certManager:
dnsNames:
- smtp.example.com
issuerRef:
group: cert-manager.io
kind: ClusterIssuer
name: selfsigned
25 changes: 25 additions & 0 deletions charts/mailpit/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,28 @@
.Values.mailpit.relay.config
}}true{{ end -}}
{{- end }}

{{/* Return the SMTP Service name. */}}
{{- define "mailpit.smtp.serviceName" -}}
{{- default (printf "%s-smtp" (include "common.names.fullname" .)) .Values.service.smtp.name -}}
{{- end -}}

{{/* Return configured SMTP TLS DNS names or the SMTP Service DNS names. */}}
{{- define "mailpit.smtp.tls.dnsNames" -}}
{{- $context := .context -}}
{{- with .dnsNames -}}
{{- include "common.tplvalues.render" (dict "value" . "context" $context) -}}
{{- else -}}
{{- $smtpService := include "mailpit.smtp.serviceName" $context -}}
{{- $namespace := include "common.names.namespace" $context -}}
- {{ $smtpService }}
- {{ $smtpService }}.{{ $namespace }}
- {{ $smtpService }}.{{ $namespace }}.svc
- {{ $smtpService }}.{{ $namespace }}.svc.{{ $context.Values.clusterDomain }}
{{- end -}}
{{- end -}}

{{/* Return the name of the SMTP TLS Secret managed by cert-manager. */}}
{{- define "mailpit.smtp.tls.certManager.secretName" -}}
{{- printf "%s-smtp-tls" (include "common.names.fullname" .) -}}
{{- end -}}
19 changes: 19 additions & 0 deletions charts/mailpit/templates/certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and .Values.mailpit.smtp.tls.enabled (eq .Values.mailpit.smtp.tls.method "cert-manager") }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" .) | nindent 4 }}
{{- with .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}
{{- end }}
spec:
secretName: {{ include "mailpit.smtp.tls.certManager.secretName" . }}
usages:
- server auth
dnsNames: {{- include "mailpit.smtp.tls.dnsNames" (dict "dnsNames" .Values.mailpit.smtp.tls.certManager.dnsNames "context" $) | nindent 4 }}
{{- with .Values.mailpit.smtp.tls.certManager.issuerRef }}
issuerRef: {{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}
{{- end }}
{{- end }}
23 changes: 20 additions & 3 deletions charts/mailpit/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,20 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.mailpit.smtp.tls.enabled }}
{{- $autoDNSNames := include "mailpit.smtp.tls.dnsNames" (dict "dnsNames" .Values.mailpit.smtp.tls.auto.dnsNames "context" $) | fromYamlArray }}
- --smtp-tls-cert
{{- if eq .Values.mailpit.smtp.tls.method "auto" }}
- {{ printf "sans:%s" (join "," $autoDNSNames) | quote }}
{{- else }}
- /etc/mailpit/smtp.crt
{{- end }}
- --smtp-tls-key
{{- if eq .Values.mailpit.smtp.tls.method "auto" }}
- {{ printf "sans:%s" (join "," $autoDNSNames) | quote }}
{{- else }}
- /etc/mailpit/smtp.key
{{- end }}
{{- end }}
{{- if .Values.image.debug }}
- --verbose
{{- end }}
Expand Down Expand Up @@ -130,12 +139,14 @@ spec:
{{- end }}
{{- end }}
volumeMounts:
- name: tmp
mountPath: /tmp
- name: data
mountPath: /var/lib/mailpit
{{- if .Values.volumeSubPath }}
subPath: {{ .Values.volumeSubPath }}
{{- end }}
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.smtp.authFile.enabled .Values.mailpit.ui.tls.secretName .Values.mailpit.smtp.tls.secretName .Values.mailpit.relay.enabled }}
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.smtp.authFile.enabled .Values.mailpit.ui.tls.secretName (and .Values.mailpit.smtp.tls.enabled (ne .Values.mailpit.smtp.tls.method "auto")) .Values.mailpit.relay.enabled }}
- name: etc
mountPath: /etc/mailpit
{{- end }}
Expand All @@ -158,7 +169,7 @@ spec:
{{- with .Values.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}
{{- end }}
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.smtp.authFile.enabled .Values.mailpit.ui.tls.enabled .Values.mailpit.smtp.tls.enabled .Values.mailpit.relay.enabled }}
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.smtp.authFile.enabled .Values.mailpit.ui.tls.enabled (and .Values.mailpit.smtp.tls.enabled (ne .Values.mailpit.smtp.tls.method "auto")) .Values.mailpit.relay.enabled }}
- name: etc
projected:
sources:
Expand Down Expand Up @@ -189,9 +200,13 @@ spec:
- key: tls.key
path: ui.key
{{- end }}
{{- if .Values.mailpit.smtp.tls.enabled }}
{{- if and .Values.mailpit.smtp.tls.enabled (ne .Values.mailpit.smtp.tls.method "auto") }}
- secret:
{{- if eq .Values.mailpit.smtp.tls.method "cert-manager" }}
name: {{ include "mailpit.smtp.tls.certManager.secretName" . }}
{{- else }}
name: {{ .Values.mailpit.smtp.tls.secretName | required "mailpit.smtp.tls.secretName required when tls is enabled" }}
{{- end }}
items:
- key: tls.crt
path: smtp.crt
Expand All @@ -206,3 +221,5 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
- name: tmp
emptyDir: {}
2 changes: 1 addition & 1 deletion charts/mailpit/templates/smtp-service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.smtp.name | default ( printf "%s-smtp" (include "common.names.fullname" .)) }}
name: {{ include "mailpit.smtp.serviceName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- with include "common.tplvalues.merge" ( dict "values" (list .Values.service.smtp.annotations .Values.commonAnnotations) "context" . ) | fromYaml }}
Expand Down
21 changes: 18 additions & 3 deletions charts/mailpit/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ global:
## @section Common
##

## @param clusterDomain Kubernetes Cluster Domain
##
clusterDomain: cluster.local

## Bitnami image
## ref: https://hub.docker.com/r/bitnami/image/tags/
## @param image.registry image registry
Expand All @@ -33,7 +37,7 @@ global:
image:
registry: docker.io
repository: axllent/mailpit
tag: v1.31.0
tag: v1.31.1
digest: ""
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
Expand Down Expand Up @@ -209,11 +213,22 @@ mailpit:
enabled: false
htpasswd: ""
existingSecret: {}
## @param mailpit.smtp.tls.enabled Enable tls for SMTP
## @param mailpit.smtp.tls.secretName tls secret for SMTP
## ref: https://mailpit.axllent.org/docs/configuration/certificates/#auto-generate-self-signed-certificates
## @param mailpit.smtp.tls.enabled Enable TLS for SMTP
## @param mailpit.smtp.tls.method TLS certificate source: generated by Mailpit (`auto`), cert-manager (`cert-manager`) or an existing Secret (`secret`)
## @param mailpit.smtp.tls.secretName Existing TLS Secret for SMTP when method is secret
## @param mailpit.smtp.tls.auto.dnsNames DNS names included in the certificate generated by Mailpit. Defaults to the SMTP Service names
## @param mailpit.smtp.tls.certManager.dnsNames DNS names included in the certificate. Defaults to the SMTP Service names
## @param mailpit.smtp.tls.certManager.issuerRef cert-manager issuer for the certificate
tls:
enabled: false
method: secret
secretName: ""
auto:
dnsNames: []
certManager:
dnsNames: []
issuerRef: {}
relay:
## @param mailpit.relay.enabled enable SMTP Relay configuration
## @param mailpit.relay.config Mailpit SMTP relay configuration
Expand Down
Loading