2025-05-11 00:34:55 +03:00

157 lines
7.4 KiB
YAML

---
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ printf "%s-postfix" (include "mailu.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: postfix
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: 1
{{- if .Values.postfix.updateStrategy }}
strategy: {{- toYaml .Values.postfix.updateStrategy | nindent 4 }}
{{- end }}
revisionHistoryLimit: {{ .Values.postfix.revisionHistoryLimit }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: postfix
template:
metadata:
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: postfix
{{- if .Values.postfix.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.postfix.podLabels "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postfix.podAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.postfix.podAnnotations "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "common.images.pullSecrets" (dict "images" (list .Values.postfix.image) "global" .Values.global) | nindent 6 }}
{{- if .Values.postfix.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postfix.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postfix.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postfix.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.tolerations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postfix.priorityClassName }}
priorityClassName: {{ .Values.postfix.priorityClassName | quote }}
{{- end }}
{{- if .Values.postfix.schedulerName }}
schedulerName: {{ .Values.postfix.schedulerName | quote }}
{{- end }}
{{- if .Values.postfix.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.topologySpreadConstraints "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postfix.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.postfix.terminationGracePeriodSeconds }}
{{- end }}
{{- if .Values.postfix.initContainers }}
initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.postfix.podSecurityContext.enabled }}
securityContext: {{- omit .Values.postfix.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: postfix
image: {{ .Values.imageRegistry }}/{{ .Values.postfix.image.repository }}:{{ default (include "mailu.version" .) .Values.postfix.image.tag }}
imagePullPolicy: {{ .Values.postfix.image.pullPolicy }}
{{- if .Values.postfix.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.postfix.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /queue
name: data
subPath: mailqueue
{{- if .Values.postfix.overrides }}
- name: overrides
mountPath: /overrides
{{- end }}
{{- if .Values.postfix.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.postfix.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
env:
- name: LOG_LEVEL
value: {{ default .Values.logLevel .Values.postfix.logLevel }}
{{- tpl (include "mailu.envvars.secrets" .) $ | nindent 12 }}
{{- if .Values.postfix.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.postfix.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ printf "%s-envvars" (include "mailu.fullname" .) }}
{{- if .Values.postfix.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.postfix.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.postfix.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.postfix.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- name: smtp
containerPort: 25
protocol: TCP
- name: smtp-ssl
containerPort: 465
protocol: TCP
- name: smtp-starttls
containerPort: 587
protocol: TCP
- name: smtp-auth
containerPort: 10025
protocol: TCP
{{- if .Values.postfix.resources }}
resources: {{- toYaml .Values.postfix.resources | nindent 12 }}
{{- end }}
{{- if .Values.postfix.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.postfix.startupProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- sh
- -c
- '! /usr/libexec/postfix/master -t'
{{- end }}
{{- if .Values.postfix.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.postfix.livenessProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- sh
- -c
- '! /usr/libexec/postfix/master -t'
{{- end }}
{{- if .Values.postfix.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.postfix.readinessProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- sh
- -c
- '! /usr/libexec/postfix/master -t'
{{- end }}
{{- if .Values.postfix.extraContainers }}
{{- toYaml .Values.postfix.extraContainers | nindent 8 }}
{{- end }}
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ include "mailu.postfix.claimName" . }}
{{- if .Values.postfix.overrides }}
- name: overrides
configMap:
name: {{ printf "%s-postfix-override" (include "mailu.fullname" .) }}
{{- end }}
{{- if .Values.postfix.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.postfix.extraVolumes "context" $) | nindent 8 }}
{{- end }}