130 lines
4.4 KiB
YAML
130 lines
4.4 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "mailhog.fullname" . }}
|
|
labels:
|
|
{{- include "mailhog.labels" . | nindent 4 }}
|
|
namespace: {{ .Release.Namespace | quote }}
|
|
spec:
|
|
replicas: {{ .Values.podReplicas }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "mailhog.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
{{- with .Values.podAnnotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "mailhog.selectorLabels" . | nindent 8 }}
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
serviceAccountName: {{ include "mailhog.serviceAccountName" . }}
|
|
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
|
|
{{- with .Values.securityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ template "mailhog.name" . }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
|
env:
|
|
{{- $vars := list }}
|
|
{{- range .Values.extraEnv }}
|
|
{{- $vars = append $vars .name }}
|
|
{{- end }}
|
|
{{- if not (has "MH_HOSTNAME" $vars) }}
|
|
- name: MH_HOSTNAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
{{- end }}
|
|
{{- if .Values.auth.enabled }}
|
|
- name: MH_AUTH_FILE
|
|
value: /authdir/{{ .Values.auth.fileName }}
|
|
{{- end }}
|
|
{{- if .Values.outgoingSMTP.enabled }}
|
|
- name: MH_OUTGOING_SMTP
|
|
value: /config/{{ .Values.outgoingSMTP.fileName }}
|
|
{{- end }}
|
|
{{- with .Values.extraEnv }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: {{ .Values.containerPort.http.name }}
|
|
containerPort: {{ .Values.containerPort.http.port }}
|
|
protocol: TCP
|
|
- name: {{ .Values.containerPort.smtp.name }}
|
|
containerPort: {{ .Values.containerPort.smtp.port }}
|
|
protocol: TCP
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: {{ .Values.containerPort.smtp.port }}
|
|
{{- if .Values.livenessProbe }}
|
|
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
|
{{- end }}
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: {{ .Values.containerPort.smtp.port }}
|
|
{{- if .Values.readinessProbe }}
|
|
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
|
{{- end }}
|
|
{{- if or .Values.auth.enabled .Values.outgoingSMTP.enabled }}
|
|
volumeMounts:
|
|
{{- if .Values.auth.enabled }}
|
|
- name: authdir
|
|
mountPath: /authdir
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- if .Values.outgoingSMTP.enabled }}
|
|
- name: outsmtpdir
|
|
mountPath: /config
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.containerSecurityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
{{- with .Values.extraContainers }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- if or .Values.auth.enabled .Values.outgoingSMTP.enabled }}
|
|
volumes:
|
|
{{- if .Values.auth.enabled }}
|
|
- name: authdir
|
|
secret:
|
|
secretName: {{ template "mailhog.authFileSecret" . }}
|
|
{{- end }}
|
|
{{- if .Values.outgoingSMTP.enabled }}
|
|
- name: outsmtpdir
|
|
secret:
|
|
secretName: {{ template "mailhog.outgoingSMTPSecret" . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.priorityClassName }}
|
|
priorityClassName: {{ .Values.priorityClassName }}
|
|
{{- end }}
|