Skip to content

Commit

Permalink
Merge pull request #1 from fr6nco/feature/smtp-relay-config
Browse files Browse the repository at this point in the history
Add options to enable SMTP relay configuration
  • Loading branch information
jouve authored May 30, 2023
2 parents af326ec + b37623c commit a5aa094
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charts/mailpit/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: mailpit
description: An email and SMTP testing tool with API for developers
type: application
version: 0.1.4
version: 0.2.0
appVersion: 1.6.10
sources:
- https://github.com/jouve/charts
Expand Down
7 changes: 6 additions & 1 deletion charts/mailpit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ helm repo add jouve https://jouve.github.io/charts/
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- |
| `image.registry` | image registry | `docker.io` |
| `image.repository` | image repository | `axllent/mailpit` |
| `image.tag` | image tag (immutable tags are recommended) | `v1.6.10` |
| `image.tag` | image tag (immutable tags are recommended) | `v1.6.10` |
| `image.digest` | image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag image tag (immutable tags are recommended) | `""` |
| `image.pullPolicy` | image pull policy | `IfNotPresent` |
| `image.pullSecrets` | image pull secrets | `[]` |
Expand Down Expand Up @@ -50,13 +50,18 @@ helm repo add jouve https://jouve.github.io/charts/
| `mailpit.smtp.authFile.htpasswd` | htpasswd content | `""` |
| `mailpit.smtp.tls.enabled` | Enable tls for SMTP | `false` |
| `mailpit.smtp.tls.secretName` | tls secret for SMTP | `""` |
| `mailpit.relay.enabled` | Enable STMP relay configuration | `false` |
| `mailpit.relay.config` | Mailpit Relay Configuration object, `smtpRelayConfigStruct struct` | `{}` |
| `mailpit.relay.relayAll` | Automatically relay all emails | `false` |

### Traffic Exposure Parameters

| Name | Description | Value |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `service.http.type` | service type | `ClusterIP` |
| `service.http.nodePort` | port to bind to in case of LoadBalancer or NodePort type | `""` |
| `service.smtp.type` | service type | `ClusterIP` |
| `service.smtp.nodePort` | port to bind to in case of LoadBalancer or NodePort type | `""` |
| `ingress.enabled` | Enable ingress record generation for %%MAIN_CONTAINER_NAME%% | `false` |
| `ingress.hostname` | Default host for the ingress record | `hostname.local` |
| `ingress.ingressClassName` | IngressClass that will be be used to implement the Ingress (Kubernetes 1.18+) | `""` |
Expand Down
15 changes: 13 additions & 2 deletions charts/mailpit/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ spec:
{{- if .Values.image.debug }}
- --verbose
{{- end }}
{{- if .Values.mailpit.relay.enabled }}
- --smtp-relay-config
- /etc/mailpit/smtp_relay.yaml
{{- if .Values.mailpit.relay.relayAll }}
- --smtp-relay-all
{{- end }}
{{- end }}
{{- with .Values.args }}
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 12 }}
{{- end }}
Expand All @@ -93,7 +100,7 @@ spec:
volumeMounts:
- name: data
mountPath: /var/lib/mailpit
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.tls.secretName .Values.mailpit.smtp.tls.secretName }}
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.tls.secretName .Values.mailpit.smtp.tls.secretName .Values.mailpit.relay.enabled }}
- name: etc
mountPath: /etc/mailpit
{{- end }}
Expand All @@ -104,7 +111,7 @@ spec:
{{- include "common.tplvalues.render" ( dict "value" . "context" $) | nindent 8 }}
{{- end }}
volumes:
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.tls.secretName .Values.mailpit.smtp.tls.secretName }}
{{- if or .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.authFile.enabled .Values.mailpit.ui.tls.secretName .Values.mailpit.smtp.tls.secretName .Values.mailpit.relay.enabled }}
- name: etc
projected:
sources:
Expand All @@ -130,6 +137,10 @@ spec:
- key: tls.key
path: smtp.key
{{- end }}
{{- if .Values.mailpit.relay.enabled }}
- secret:
name: {{ template "common.names.fullname" . }}-relay
{{- end }}
{{- end }}
- name: data
{{- if .Values.persistence.enabled }}
Expand Down
4 changes: 2 additions & 2 deletions charts/mailpit/templates/http-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ spec:
ports:
- name: http
port: 80
{{- if and (or (eq .Values.service.http.type "NodePort") (eq .Values.service.http.type "LoadBalancer")) (not (empty .Values.service.http.nodePorts.http)) }}
nodePort: {{ .Values.service.http.nodePorts.http }}
{{- if and (or (eq .Values.service.http.type "NodePort") (eq .Values.service.http.type "LoadBalancer")) (not (empty .Values.service.http.nodePort)) }}
nodePort: {{ .Values.service.http.nodePort }}
{{- end }}
targetPort: http
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
20 changes: 20 additions & 0 deletions charts/mailpit/templates/relay-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.mailpit.relay.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "common.names.fullname" . }}-relay
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- with .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }}
{{- end }}
{{- with .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
{{- with .Values.mailpit.relay.config }}
stringData:
smtp_relay.yaml: |
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/mailpit/templates/smtp-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ spec:
ports:
- name: smtp
port: 25
{{- if and (or (eq .Values.service.smtp.type "NodePort") (eq .Values.service.smtp.type "LoadBalancer")) (not (empty .Values.service.smtp.nodePorts.http)) }}
nodePort: {{ .Values.service.smtp.nodePorts.http }}
{{- if and (or (eq .Values.service.smtp.type "NodePort") (eq .Values.service.smtp.type "LoadBalancer")) (not (empty .Values.service.smtp.nodePort)) }}
nodePort: {{ .Values.service.smtp.nodePort }}
{{- end }}
targetPort: smtp
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
12 changes: 11 additions & 1 deletion charts/mailpit/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ mailpit:
tls:
enabled: false
secretName: ""

relay:
## @param mailpit.relay.enabled enable SMTP Relay configuration
## @param mailpit.relay.config Mailpit SMTP relay configuration
## @param.mailpit.relay.relayAll Relay all messages to relay
enabled: false
config: {}
relayAll: false

## @section Traffic Exposure Parameters
##
Expand All @@ -122,12 +128,16 @@ mailpit:
service:
http:
## @param service.http.type service type
## @param service.http.nodePort nodeport bind for HTTP service
##
type: ClusterIP
nodePort:
smtp:
## @param service.smtp.type service type
## @param service.smtp.nodePort nodeport bind for STMP service
##
type: ClusterIP
nodePort:


## ingress parameters
Expand Down

0 comments on commit a5aa094

Please sign in to comment.