Rename chart and fix minor issues

This commit is contained in:
Bojan Čekrlić 2020-10-25 17:43:58 +01:00
parent cf22956bf7
commit 6bae2c20ba
12 changed files with 45 additions and 35 deletions

View file

@ -1,5 +1,5 @@
apiVersion: v2 apiVersion: v2
name: postfix name: mail
description: Helm chart for Postfix mail server description: Helm chart for Postfix mail server
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.

View file

@ -1,16 +1,16 @@
Postfix service installed. Send email by using the following address and port: Postfix service installed. Send email by using the following address and port:
{{- if contains "NodePort" .Values.service.type }} {{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "postfix.fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mail.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }} {{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "postfix.fullname" . }}' You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "mail.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "postfix.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mail.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }} {{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "postfix.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "mail.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application" echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 587:587
{{- end }} {{- end }}

View file

@ -2,7 +2,7 @@
{{/* {{/*
Expand the name of the chart. Expand the name of the chart.
*/}} */}}
{{- define "postfix.name" -}} {{- define "mail.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }} {{- end }}
@ -11,7 +11,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name. If release name contains chart name it will be used as a full name.
*/}} */}}
{{- define "postfix.fullname" -}} {{- define "mail.fullname" -}}
{{- if .Values.fullnameOverride }} {{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }} {{- else }}
@ -27,16 +27,16 @@ If release name contains chart name it will be used as a full name.
{{/* {{/*
Create chart name and version as used by the chart label. Create chart name and version as used by the chart label.
*/}} */}}
{{- define "postfix.chart" -}} {{- define "mail.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }} {{- end }}
{{/* {{/*
Common labels Common labels
*/}} */}}
{{- define "postfix.labels" -}} {{- define "mail.labels" -}}
helm.sh/chart: {{ include "postfix.chart" . }} helm.sh/chart: {{ include "mail.chart" . }}
{{ include "postfix.selectorLabels" . }} {{ include "mail.selectorLabels" . }}
{{- if .Chart.AppVersion }} {{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }} {{- end }}
@ -46,17 +46,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/* {{/*
Selector labels Selector labels
*/}} */}}
{{- define "postfix.selectorLabels" -}} {{- define "mail.selectorLabels" -}}
app.kubernetes.io/name: {{ include "postfix.name" . }} app.kubernetes.io/name: {{ include "mail.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }} {{- end }}
{{/* {{/*
Create the name of the service account to use Create the name of the service account to use
*/}} */}}
{{- define "postfix.serviceAccountName" -}} {{- define "mail.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }} {{- if .Values.serviceAccount.create }}
{{- default (include "postfix.fullname" .) .Values.serviceAccount.name }} {{- default (include "mail.fullname" .) .Values.serviceAccount.name }}
{{- else }} {{- else }}
{{- default "default" .Values.serviceAccount.name }} {{- default "default" .Values.serviceAccount.name }}
{{- end }} {{- end }}
@ -65,13 +65,13 @@ Create the name of the service account to use
{{/* {{/*
Define checksum annotations Define checksum annotations
*/}} */}}
{{- define "postfix.checksums" -}} {{- define "mail.checksums" -}}
# Reload for Statefulset when configmap changes on deployment # Reload for Statefulset when configmap changes on deployment
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end -}} {{- end -}}
{{- define "postfix.reloader" -}} {{- define "mail.reloader" -}}
# Auto-reload postfix if somebody changes config map directly in Kuberentes. # Auto-reload postfix if somebody changes config map directly in Kuberentes.
# Uses: https://github.com/stakater/Reloader # Uses: https://github.com/stakater/Reloader
configmap.reloader.stakater.com/reload: "{{ include "postfix.fullname" . }}" configmap.reloader.stakater.com/reload: "{{ include "mail.fullname" . }}"
{{- end -}} {{- end -}}

View file

@ -1,4 +1,4 @@
{{- $chart := "postfix" -}} {{- $chart := "mail" -}}
{{- $fullName := include (print $chart ".fullname") . -}} {{- $fullName := include (print $chart ".fullname") . -}}
{{- $labels := include (print $chart ".labels") . -}} {{- $labels := include (print $chart ".labels") . -}}
{{- $files := .Files -}} {{- $files := .Files -}}

View file

@ -1,5 +1,5 @@
{{- if .Values.autoscaling.enabled }} {{- if .Values.autoscaling.enabled }}
{{- $chart := "postfix" -}} {{- $chart := "mail" -}}
{{- $fullName := include (print $chart ".fullname") . -}} {{- $fullName := include (print $chart ".fullname") . -}}
{{- $labels := include (print $chart ".labels") . -}} {{- $labels := include (print $chart ".labels") . -}}
{{- $kind := "StatefulSet" -}} {{- $kind := "StatefulSet" -}}

View file

@ -1,4 +1,4 @@
{{- $chart := "postfix" -}} {{- $chart := "mail" -}}
{{- $fullName := include (print $chart ".fullname") . -}} {{- $fullName := include (print $chart ".fullname") . -}}
{{- $labels := include (print $chart ".labels") . -}} {{- $labels := include (print $chart ".labels") . -}}
{{- $selectorLabels := include (print $chart ".selectorLabels") . -}} {{- $selectorLabels := include (print $chart ".selectorLabels") . -}}

View file

@ -1,5 +1,5 @@
{{- if .Values.serviceAccount.create -}} {{- if .Values.serviceAccount.create -}}
{{- $chart := "postfix" -}} {{- $chart := "mail" -}}
{{- $labels := include (print $chart ".labels") . -}} {{- $labels := include (print $chart ".labels") . -}}
{{- $serviceAccountName := include (print $chart ".serviceAccountName") . -}} {{- $serviceAccountName := include (print $chart ".serviceAccountName") . -}}
apiVersion: v1 apiVersion: v1

View file

@ -1,4 +1,4 @@
{{- $chart := "postfix" -}} {{- $chart := "mail" -}}
{{- $fullName := include (print $chart ".fullname") . -}} {{- $fullName := include (print $chart ".fullname") . -}}
{{- $labels := include (print $chart ".labels") . -}} {{- $labels := include (print $chart ".labels") . -}}
{{- $reloaderAnnotations := include (print $chart ".reloader") . -}} {{- $reloaderAnnotations := include (print $chart ".reloader") . -}}
@ -55,22 +55,21 @@ spec:
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext: {{- toYaml .Values.container.postfix.securityContext | indent 12 }} securityContext: {{- toYaml .Values.container.postfix.securityContext | indent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
ports: ports:
- name: smtp - name: smtp
containerPort: 587 containerPort: 587
protocol: TCP protocol: TCP
readinessProbe: readinessProbe:
initialDelaySeconds: 10 initialDelaySeconds: 10
periodSeconds: 60 periodSeconds: 30
tcpSocket: tcpSocket:
port: 587 port: 587
livenessProbe: livenessProbe:
initialDelaySeconds: 10 initialDelaySeconds: 10
periodSeconds: 120 periodSeconds: 60
tcpSocket: tcpSocket:
port: 587 port: 587
envFrom: envFrom:
@ -82,7 +81,14 @@ spec:
name: {{ $fullName }} name: {{ $fullName }}
{{- with .Values.extraVolumeMounts }}{{- toYaml . | nindent 12 }}{{ end }} {{- with .Values.extraVolumeMounts }}{{- toYaml . | nindent 12 }}{{ end }}
resources: {{ toYaml .Values.resources | nindent 12 }} resources: {{ toYaml .Values.resources | nindent 12 }}
{{- if .Values.persistence.enabled }}
{{- with .Values.extraVolumes }}volumes: {{- toYaml . | nindent 8 }}{{ end }}
{{- else }}
volumes:
- name: {{ $fullName }}
emptyDir: {}
{{- with .Values.extraVolumes }}{{- toYaml . | nindent 8 }}{{ end }}
{{- end }}
{{- if .Values.persistence.enabled }} {{- if .Values.persistence.enabled }}
volumeClaimTemplates: volumeClaimTemplates:
- metadata: - metadata:
@ -98,10 +104,4 @@ spec:
resources: resources:
requests: requests:
storage: {{ .Values.persistence.size | quote }} storage: {{ .Values.persistence.size | quote }}
{{ with .Values.extraVolumes }}volumes: {{- toYaml . | nindent 4 }}{{ end }}
{{- else }}
volumes:
- name: {{ $fullName }}
emptyDir: {}
{{- with .Values.extraVolumes }}{{- toYaml . | nindent 4 }}{{ end }}
{{- end }} {{- end }}

View file

@ -2,6 +2,7 @@ replicaCount: 1
image: image:
repository: boky/postfix repository: boky/postfix
# tag: "" # If not specified uses chart's AppVersion as the tag
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
imagePullSecrets: [] imagePullSecrets: []

View file

@ -1,2 +1,11 @@
image:
tag: v2.0.1 # Override version from Chart's AppVersion
persistence: persistence:
enabled: false enabled: false
config:
general:
TZ: Europe/London
ALLOWED_SENDER_DOMAINS: example.org
FORCE_COLOR: "1"