183 lines
9.0 KiB
YAML
183 lines
9.0 KiB
YAML
---
|
|
{{- if .Values.clamav.enabled }}
|
|
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ printf "%s-clamav" (include "mailu.fullname" .) }}
|
|
namespace: {{ include "common.names.namespace" . | quote }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
app.kubernetes.io/component: clamav
|
|
{{- 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: {{ .Values.clamav.replicaCount }}
|
|
{{- if .Values.clamav.updateStrategy }}
|
|
updateStrategy:
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.clamav.updateStrategy "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
serviceName: {{ include "mailu.clamav.serviceNameHeadless" . | quote }}
|
|
selector:
|
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
|
app.kubernetes.io/component: clamav
|
|
template:
|
|
metadata:
|
|
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
|
app.kubernetes.io/component: clamav
|
|
{{- if .Values.clamav.podLabels }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.clamav.podLabels "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.podAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.clamav.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- include "common.images.pullSecrets" (dict "images" (list .Values.clamav.image) "global" .Values.global) | nindent 6 }}
|
|
{{- if .Values.clamav.hostAliases }}
|
|
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.hostAliases "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.nodeSelector }}
|
|
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.affinity }}
|
|
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.affinity "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.tolerations }}
|
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.tolerations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.priorityClassName }}
|
|
priorityClassName: {{ .Values.clamav.priorityClassName | quote }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.schedulerName }}
|
|
schedulerName: {{ .Values.clamav.schedulerName | quote }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.topologySpreadConstraints }}
|
|
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.topologySpreadConstraints "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.terminationGracePeriodSeconds }}
|
|
terminationGracePeriodSeconds: {{ .Values.clamav.terminationGracePeriodSeconds }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.initContainers }}
|
|
initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.initContainers "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.podSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.clamav.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: clamav
|
|
image: {{ .Values.clamav.image.registry }}/{{ .Values.clamav.image.repository }}:{{ .Values.clamav.image.tag }}
|
|
imagePullPolicy: {{ .Values.clamav.image.pullPolicy }}
|
|
{{- if .Values.clamav.containerSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.clamav.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: data
|
|
subPath: clamav
|
|
mountPath: /var/lib/clamav
|
|
{{- if .Values.clamav.extraVolumeMounts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.clamav.extraVolumeMounts "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
env:
|
|
- name: LOG_LEVEL
|
|
value: {{ default .Values.logLevel .Values.clamav.logLevel }}
|
|
{{- tpl (include "mailu.envvars.secrets" .) $ | nindent 12 }}
|
|
{{- if .Values.clamav.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.clamav.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
- configMapRef:
|
|
name: {{ printf "%s-envvars" (include "mailu.fullname" .) }}
|
|
{{- if .Values.clamav.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.clamav.extraEnvVarsCM "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.clamav.extraEnvVarsSecret "context" $) }}
|
|
{{- end }}
|
|
ports:
|
|
- name: clamav
|
|
containerPort: 3310
|
|
protocol: TCP
|
|
{{- if .Values.clamav.resources }}
|
|
resources: {{- toYaml .Values.clamav.resources | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.startupProbe.enabled }}
|
|
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.clamav.startupProbe "enabled") "context" $) | nindent 12 }}
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- 'kill -0 `cat /tmp/clamd.pid` && kill -0 `cat /tmp/freshclam.pid`'
|
|
{{- end }}
|
|
{{- if .Values.clamav.livenessProbe.enabled }}
|
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.clamav.livenessProbe "enabled") "context" $) | nindent 12 }}
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- 'kill -0 `cat /tmp/clamd.pid` && kill -0 `cat /tmp/freshclam.pid`'
|
|
{{- end }}
|
|
{{- if .Values.clamav.readinessProbe.enabled }}
|
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.clamav.readinessProbe "enabled") "context" $) | nindent 12 }}
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- 'kill -0 `cat /tmp/clamd.pid` && kill -0 `cat /tmp/freshclam.pid`'
|
|
{{- end }}
|
|
{{- if .Values.clamav.extraContainers }}
|
|
{{- toYaml .Values.clamav.extraContainers | nindent 8 }}
|
|
{{- end }}
|
|
volumes:
|
|
{{- if .Values.clamav.extraVolumes }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.clamav.extraVolumes "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if not .Values.clamav.persistence.enabled }}
|
|
- name: data
|
|
emptyDir: {}
|
|
{{- else if .Values.clamav.persistence.existingClaim }}
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: {{ printf "%s" (tpl .Values.clamav.persistence.existingClaim .) }}
|
|
{{- else }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
labels: {{- include "common.labels.standard" . | nindent 10 }}
|
|
app.kubernetes.io/component: clamav
|
|
{{- if .Values.clamav.persistence.labels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.clamav.persistence.labels "context" $ ) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if or .Values.clamav.persistence.annotations .Values.commonAnnotations }}
|
|
annotations:
|
|
{{- if .Values.clamav.persistence.annotations }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.clamav.persistence.annotations "context" $ ) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 10 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
spec:
|
|
accessModes:
|
|
{{- range .Values.clamav.persistence.accessModes }}
|
|
- {{ . | quote }}
|
|
{{- end }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.clamav.persistence.size | quote }}
|
|
{{- if .Values.clamav.persistence.selector }}
|
|
selector: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.persistence.selector "context" $) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.clamav.persistence.dataSource }}
|
|
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.clamav.persistence.dataSource "context" $) | nindent 10 }}
|
|
{{- end }}
|
|
{{- include "common.storage.class" (dict "persistence" .Values.clamav.persistence "global" .Values.global) | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|