From 0b1c93950f4f882ab7585ce18a16b92cbd67b9c2 Mon Sep 17 00:00:00 2001 From: Nick Douma Date: Tue, 2 May 2023 17:00:22 +0200 Subject: [PATCH 1/2] Simplify configuration by allowing direct configuration of arguments and env vars. --- charts/maildev/README.md | 33 +++++---------- charts/maildev/templates/deployment.yaml | 44 ++++---------------- charts/maildev/values.yaml | 52 +++++++----------------- 3 files changed, 34 insertions(+), 95 deletions(-) diff --git a/charts/maildev/README.md b/charts/maildev/README.md index faa3cb3..1839b2d 100644 --- a/charts/maildev/README.md +++ b/charts/maildev/README.md @@ -12,39 +12,26 @@ MailDev also provides a Web interface, it can be disabled/enabled at discretion. Also note that mails do not persist after reboot. Everytime MailDev starts, it starts from scratch, even if the `/tmp/maildev` folder, where MailDev stores mails, is persisted. -## Sources code +## Source code MailDev source code can be found here: https://github.com/maildev/maildev. ## Known issue with Env Vars -GitHub issue: https://github.com/maildev/maildev/issues/315 - -So, not every option can be configured using env vars, so, a few options are hardcoded in the deployment: -`["--verbose", "--outgoing-secure", "--auto-relay"]` +GitHub issue: https://github.com/maildev/maildev/issues/315 . Configure the affected options using **args** instead. ## Configuration -Table with the most relevant parameters for MailDev. +Table with the most relevant parameters for MailDev. All other parameters can be configured by either overriding +the arguments using **args** or by providing and environment variable using **env**. See the [Usage section](https://github.com/maildev/maildev#usage) +in the MailDev repo for all available options. + Not listing here the more general paramaters such as tolerations, nodeSelectors, etc. -| Parameter | Description | Default | -|------------------------------:|:--------------------------------------------------------------------------------------------------|:--------------------------------------------| -| **outgoing_relay.host** | SMTP Relay host, `MAILDEV_OUTGOING_HOST`. | `` | -| **outgoing_relay.port** | SMTP Relay port, `MAILDEV_OUTGOING_PORT`. | `` | -| **outgoing_relay.user** | SMTP Relay user, `MAILDEV_OUTGOING_USER`. | `` | -| **outgoing_relay.pass** | SMTP Relay password, `MAILDEV_OUTGOING_PASS`. | `` | -| **outgoing_relay.secure** | Use SMTP SSL for outgoing emails, `MAILDEV_OUTGOING_SECURE`. | `true`. Hardcoded in the deployment due to a bug. | -| **ports.smtp** | Port where the SMTP service is listening. (Irrelevant for OCP/K8S), `MAILDEV_SMTP_PORT`. | `1025` | -| **ports.web** | Port where the Web interface service is listening. (Irrelevant for OCP/K8S), `MAILDEV_WEB_PORT`. | `1080` | -| **web.disable** | Disable Web interface. `MAILDEV_DISABLE_WEB`. | `false` | -| **web.user** | Web interface user, `MAILDEV_WEB_USER`. | `admin` | -| **web.pass** | Web interface password, `MAILDEV_WEB_PASS`. | `` | -| **https.enabled** | Switch from http to https protocol, `MAILDEV_HTTPS`. | `false` | -| **https.key** | The file path to the ssl private key, `MAILDEV_HTTPS_KEY`. | | -| **https.cert** | The file path to the ssl cert file, `MAILDEV_HTTPS_CERT`. | | -| **incoming.user** | SMTP user for incoming emails, `MAILDEV_INCOMING_USER`. | | -| **incoming.pass** | SMTP password for incoming emails, `MAILDEV_INCOMING_PASS`. | | +| Parameter | Description | Default | +|------------------------------:|:--------------------------------------------------------------------------------------------------|:--------| +| **ports.smtp** | Port where the SMTP service is listening. (Irrelevant for OCP/K8S), `MAILDEV_SMTP_PORT`. | `1025` | +| **ports.web** | Port where the Web interface service is listening. (Irrelevant for OCP/K8S), `MAILDEV_WEB_PORT`. | `1080` | ## Test it diff --git a/charts/maildev/templates/deployment.yaml b/charts/maildev/templates/deployment.yaml index 0b19223..48bd6e0 100644 --- a/charts/maildev/templates/deployment.yaml +++ b/charts/maildev/templates/deployment.yaml @@ -30,8 +30,12 @@ spec: securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - command: ["/usr/src/app/bin/maildev"] - args: ["--verbose", "--outgoing-secure", "--auto-relay"] + {{- if .Values.command }} + command: {{- toYaml .Values.command | nindent 12 }} + {{- end }} + {{- if .Values.args }} + args: {{- toYaml .Values.args | nindent 12 }} + {{- end }} imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: smtp-port @@ -41,43 +45,13 @@ spec: containerPort: {{ .Values.ports.web }} protocol: TCP env: - - name: MAILDEV_DISABLE_WEB - value: "{{ .Values.web.disable }}" - {{- if or .Values.web.user .Values.web.pass}} - - name: MAILDEV_WEB_USER - value: "{{ .Values.web.user }}" - - name: MAILDEV_WEB_PASS - value: "{{ .Values.web.pass }}" - {{- end }} - name: MAILDEV_SMTP_PORT value: "{{ .Values.ports.smtp }}" - name: MAILDEV_WEB_PORT value: "{{ .Values.ports.web }}" - - name: MAILDEV_HTTPS - value: "{{ .Values.https.enabled }}" - {{- if .Values.https.key }} - - name: MAILDEV_HTTPS_KEY - value: "{{ .Values.https.key }}" - {{- end }} - {{- if .Values.https.cert }} - - name: MAILDEV_HTTPS_CERT - value: "{{ .Values.https.cert }}" - {{- end }} - - name: MAILDEV_OUTGOING_HOST - value: "{{ .Values.outgoing_relay.host }}" - - name: MAILDEV_OUTGOING_PORT - value: "{{ .Values.outgoing_relay.port }}" - - name: MAILDEV_OUTGOING_USER - value: "{{ .Values.outgoing_relay.user }}" - - name: MAILDEV_OUTGOING_PASS - value: "{{ .Values.outgoing_relay.pass }}" - - name: MAILDEV_OUTGOING_SECURE - value: "{{ .Values.outgoing_relay.secure }}" - {{- if .Values.incoming }} - - name: MAILDEV_INCOMING_USER - value: "{{ .Values.incoming.user }}" - - name: MAILDEV_INCOMING_PASS - value: "{{ .Values.incoming.pass }}" + {{- range $name, $value := .Values.env }} + - name: {{ $name }} + value: {{ $value }} {{- end }} livenessProbe: httpGet: diff --git a/charts/maildev/values.yaml b/charts/maildev/values.yaml index 9212fa3..fea8373 100644 --- a/charts/maildev/values.yaml +++ b/charts/maildev/values.yaml @@ -3,26 +3,21 @@ replicaCount: 1 image: repository: maildev/maildev pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: 1.1.0 - -outgoing_relay: - # MAILDEV_OUTGOING_HOST - host: smtp.gmail.com - # MAILDEV_OUTGOING_PORT - port: 465 - # MAILDEV_OUTGOING_USER - user: 'XXX' - # MAILDEV_OUTGOING_PASS - pass: 'YYY' - # MAILDEV_OUTGOING_SECURE - secure: true - -incoming: - # MAILDEV_INCOMING_USER - # user: - # MAILDEV_INCOMING_PASS - # pass: + # tag: 2.0.5 + +# command: +args: +- --verbose + +env: + # MAILDEV_OUTGOING_HOST: smtp.gmail.com + # MAILDEV_OUTGOING_PORT: 465 + # MAILDEV_OUTGOING_USER: "XXX" + # MAILDEV_OUTGOING_PASS: "YYY" + # MAILDEV_INCOMING_USER: "" + # MAILDEV_INCOMING_PASS: "" + # MAILDEV_WEB_USER: "admin" + # MAILDEV_WEB_PASS: "admin" ports: # MAILDEV_SMTP_PORT @@ -30,23 +25,6 @@ ports: # MAILDEV_WEB_PORT web: 1080 -# MAILDEV_HTTPS -https: - enabled: false - # MAILDEV_HTTPS_KEY - # key: - # MAILDEV_HTTPS_KEY - # cert: - -# Web interface -web: - # MAILDEV_DISABLE_WEB - disable: false - # MAILDEV_WEB_USER - user: admin - # MAILDEV_WEB_PASS - pass: admin - imagePullSecrets: [] nameOverride: "" fullnameOverride: "" From 0d19613d442d821277f4a5bdb2e574915c72369e Mon Sep 17 00:00:00 2001 From: Nick Douma Date: Tue, 2 May 2023 17:00:51 +0200 Subject: [PATCH 2/2] Bump Helm chart version --- charts/maildev/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/maildev/Chart.yaml b/charts/maildev/Chart.yaml index cd73dd4..1233052 100644 --- a/charts/maildev/Chart.yaml +++ b/charts/maildev/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: maildev -version: 0.1.3 -appVersion: 1.1.0 +version: 0.2.0 +appVersion: 2.0.5 type: application description: SMTP Server + Web Interface for viewing and testing emails during development. keywords: