2025-05-11 02:04:51 +03:00

207 lines
9.1 KiB
YAML

---
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: {{ .Values.front.kind }}
metadata:
name: {{ printf "%s-front" (include "mailu.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: front
{{- 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:
{{- if eq .Values.front.kind "Deployment" }}
replicas: {{ .Values.front.replicaCount }}
{{- end }}
{{- if and .Values.front.updateStrategy (eq .Values.front.kind "Deployment") }}
strategy: {{- toYaml .Values.front.updateStrategy | nindent 4 }}
{{- end }}
{{- if and .Values.front.updateStrategy (eq .Values.front.kind "DaemonSet") }}
updateStrategy: {{- toYaml .Values.front.updateStrategy | nindent 4 }}
{{- end }}
revisionHistoryLimit: {{ .Values.front.revisionHistoryLimit }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: front
template:
metadata:
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: front
{{- if .Values.front.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.front.podLabels "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.front.podAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.front.podAnnotations "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "common.images.pullSecrets" (dict "images" (list .Values.front.image) "global" .Values.global) | nindent 6 }}
{{- if .Values.front.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.front.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.front.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.front.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.front.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.front.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.front.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.front.tolerations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.front.priorityClassName }}
priorityClassName: {{ .Values.front.priorityClassName | quote }}
{{- end }}
{{- if .Values.front.schedulerName }}
schedulerName: {{ .Values.front.schedulerName | quote }}
{{- end }}
{{- if .Values.front.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.front.topologySpreadConstraints "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.front.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.front.terminationGracePeriodSeconds }}
{{- end }}
{{- if .Values.front.initContainers }}
initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.front.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.front.podSecurityContext.enabled }}
securityContext: {{- omit .Values.front.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: front
image: {{ .Values.imageRegistry }}/{{ .Values.front.image.repository }}:{{ default (include "mailu.version" .) .Values.front.image.tag }}
imagePullPolicy: {{ .Values.front.image.pullPolicy }}
{{- if .Values.front.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.front.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- name: certs
mountPath: /certs
{{- if .Values.front.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.front.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
env:
- name: LOG_LEVEL
value: {{ default .Values.logLevel .Values.front.logLevel }}
{{- tpl (include "mailu.envvars.secrets" .) $ | nindent 12 }}
{{- if .Values.front.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.front.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ printf "%s-envvars" (include "mailu.fullname" .) }}
{{- if .Values.front.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.front.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.front.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.front.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- name: pop3
protocol: TCP
containerPort: 110
{{- if .Values.front.hostPort.enabled }}
hostPort: 110
{{- end}}
- name: pop3s
protocol: TCP
containerPort: 995
{{- if .Values.front.hostPort.enabled }}
hostPort: 995
{{- end}}
- name: imap
protocol: TCP
containerPort: 143
{{- if .Values.front.hostPort.enabled }}
hostPort: 143
{{- end}}
- name: imaps
protocol: TCP
containerPort: 993
{{- if .Values.front.hostPort.enabled }}
hostPort: 993
{{- end}}
- name: smtp
protocol: TCP
containerPort: 25
{{- if .Values.front.hostPort.enabled }}
hostPort: 25
{{- end}}
- name: smtps
protocol: TCP
containerPort: 465
{{- if .Values.front.hostPort.enabled }}
hostPort: 465
{{- end}}
- name: smtp-auth
protocol: TCP
containerPort: 10025
- name: imap-auth
protocol: TCP
containerPort: 10143
- name: smtpd
protocol: TCP
containerPort: 587
{{- if .Values.front.hostPort.enabled }}
hostPort: 587
{{- end}}
- name: auth
containerPort: 8000
protocol: TCP
- name: http
containerPort: 80
protocol: TCP
- name: sieve
containerPort: 14190
protocol: TCP
{{ if not .Values.ingress.enabled }}
- name: https
containerPort: 443
protocol: TCP
{{end}}
{{- if .Values.front.resources }}
resources: {{- toYaml .Values.front.resources | nindent 12 }}
{{- end }}
{{- if .Values.front.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.front.startupProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- sh
- -c
- 'curl -skfLo /dev/null http://127.0.0.1:10204/health && kill -0 `cat /run/dovecot/master.pid`'
{{- end }}
{{- if .Values.front.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.front.livenessProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- sh
- -c
- 'curl -skfLo /dev/null http://127.0.0.1:10204/health && kill -0 `cat /run/dovecot/master.pid`'
{{- end }}
{{- if .Values.front.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.front.readinessProbe "enabled") "context" $) | nindent 12 }}
exec:
command:
- sh
- -c
- 'curl -skfLo /dev/null http://127.0.0.1:10204/health && kill -0 `cat /run/dovecot/master.pid`'
{{- end }}
{{- if .Values.front.extraContainers }}
{{- toYaml .Values.front.extraContainers | nindent 8 }}
{{- end }}
volumes:
- name: certs
secret:
items:
- key: tls.crt
path: cert.pem
- key: tls.key
path: key.pem
secretName: {{ include "mailu.certificatesSecretName" . }}
{{- if .Values.front.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.front.extraVolumes "context" $) | nindent 8 }}
{{- end }}