Add sample smtp server in Kubernetes

This commit is contained in:
Nico Schottelius 2022-04-23 12:05:38 +02:00
commit 4e3ec23f25
4 changed files with 100 additions and 0 deletions

23
.helmignore Normal file
View File

@ -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/

24
Chart.yaml Normal file
View File

@ -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"

51
templates/smtp.yaml Normal file
View File

@ -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

2
values.yaml Normal file
View File

@ -0,0 +1,2 @@
smtp_server: ""
server_hostname: ""