helm-charts/opendkim/templates/deployment.yaml
2021-01-17 04:09:41 +03:00

92 lines
3.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "opendkim.fullname" . }}
labels:
{{- include "opendkim.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "opendkim.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "opendkim.selectorLabels" . | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "opendkim.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: init-opendkim
image: "{{ .Values.opendkim.image.repository }}:{{ .Values.opendkim.image.tag }}"
command: ['sh', '-c', 'cp -a /etc/opendkim/* /tmp/ ; chmod 750 /tmp/ ; chmod 600 /tmp/keys/* ; chown opendkim:opendkim -R /tmp/ ; exit 0']
volumeMounts:
- name: opendkim-data
mountPath: /tmp
- name: opendkim-default-private
mountPath: "/etc/opendkim/keys/default.private"
subPath: default-private
- name: opendkim-default-public
mountPath: "/etc/opendkim/keys/default.txt"
subPath: default-public
- name: opendkim-opendkim
mountPath: "/etc/opendkim/opendkim.conf"
subPath: opendkim
- name: opendkim-keytable
mountPath: "/etc/opendkim/KeyTable"
subPath: keytable
- name: opendkim-signingtable
mountPath: "/etc/opendkim/SigningTable"
subPath: signingtable
- name: opendkim-trustedhosts
mountPath: "/etc/opendkim/TrustedHosts"
subPath: trustedhosts
containers:
- name: opendkim
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.opendkim.image.repository }}:{{ .Values.opendkim.image.tag }}"
imagePullPolicy: {{ .Values.opendkim.image.pullPolicy }}
#command: ['sh','-c','sleep 10000']
ports:
- name: dkim
containerPort: 8891
protocol: TCP
volumeMounts:
- name: opendkim-data
mountPath: /etc/opendkim
volumes:
- name: opendkim-data
emptyDir: {}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- range $key, $val := .Values.opendkim.configmaps }}
- name: opendkim-{{ $key }}
configMap:
name: opendkim-{{ $key }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}