commit 4e3ec23f259e7de4077c533d2b6ec0247c52e1a0 Author: Nico Schottelius Date: Sat Apr 23 12:05:38 2022 +0200 Add sample smtp server in Kubernetes diff --git a/.helmignore b/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/Chart.yaml b/Chart.yaml new file mode 100644 index 0000000..bfa025e --- /dev/null +++ b/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: smtp +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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.1.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 +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.4.0" diff --git a/templates/smtp.yaml b/templates/smtp.yaml new file mode 100644 index 0000000..c5c1f16 --- /dev/null +++ b/templates/smtp.yaml @@ -0,0 +1,51 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} +spec: + selector: + matchLabels: + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: postfix + strategy: + type: Recreate + replicas: 1 + template: + metadata: + labels: + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: postfix + spec: + containers: + - name: postfix + image: juanluisbaptiste/postfix:{{ .Chart.AppVersion }} + command: + - /bin/sh + - -c + - "postconf -e 'inet_protocols = all'; /run.sh" + ports: + - containerPort: 587 + name: submission + env: + - name: SMTP_SERVER + value: "{{ .Values.smtp_server }}" + - name: SERVER_HOSTNAME + value: "{{ .Values.server_hostname }}" +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + labels: + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: postfix +spec: + type: ClusterIP + ports: + - port: 587 + name: submission + targetPort: 587 + selector: + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: postfix diff --git a/values.yaml b/values.yaml new file mode 100644 index 0000000..f65e55a --- /dev/null +++ b/values.yaml @@ -0,0 +1,2 @@ +smtp_server: "" +server_hostname: ""