{{- if .Values.worker.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "hyrax.fullname" . }}-worker labels: {{- include "hyrax.labels" . | nindent 4 }} spec: replicas: {{ .Values.worker.replicaCount }} selector: matchLabels: {{- include "hyrax.workerSelectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "hyrax.workerSelectorLabels" . | nindent 8 }} spec: initContainers: - name: db-wait image: "{{ .Values.worker.image.repository }}:{{ .Values.worker.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.worker.image.pullPolicy }} envFrom: - configMapRef: name: {{ include "hyrax.fullname" . }}-env - secretRef: name: {{ template "hyrax.fullname" . }} env: {{- if .Values.extraEnvVars }} {{- include "hyrax.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} {{- end }} command: - sh - -c - db-wait.sh "$REDIS_HOST:6379" {{- if .Values.worker.extraInitContainers }} {{- toYaml .Values.worker.extraInitContainers | nindent 8 }} {{- end }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "hyrax.serviceAccountName" . }} securityContext: {{- toYaml .Values.worker.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }}-worker securityContext: {{- toYaml .Values.worker.securityContext | nindent 12 }} image: "{{ .Values.worker.image.repository }}:{{ .Values.worker.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.worker.image.pullPolicy }} envFrom: - configMapRef: name: {{ include "hyrax.fullname" . }}-env - secretRef: name: {{ template "hyrax.fullname" . }} {{- if .Values.solrExistingSecret }} - secretRef: name: {{ .Values.solrExistingSecret }} {{- end }} {{- with .Values.worker.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} env: {{- if .Values.extraEnvVars }} {{- include "hyrax.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} {{- end }} {{- if .Values.worker.readinessProbe.enabled }} readinessProbe: exec: command: {{- toYaml .Values.worker.readinessProbe.command | nindent 16 }} failureThreshold: {{ .Values.worker.readinessProbe.failureThreshold }} initialDelaySeconds: {{ .Values.worker.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.worker.readinessProbe.periodSeconds }} successThreshold: {{ .Values.worker.readinessProbe.successThreshold }} timeoutSeconds: {{ .Values.worker.readinessProbe.timeoutSeconds }} {{- end }} volumeMounts: - name: derivatives mountPath: /app/samvera/derivatives - name: uploads subPath: file_cache mountPath: /app/samvera/file_cache - name: uploads subPath: uploads mountPath: /app/samvera/uploads {{- if .Values.applicationExistingClaim }} - name: application mountPath: /app/samvera/hyrax-webapp {{- end }} {{- with .Values.worker.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} resources: {{- toYaml .Values.worker.resources | nindent 12 }} {{- with .Values.extraContainerConfiguration }} {{- toYaml . | nindent 10 }} {{- end }} volumes: - name: "derivatives" {{- if and .Values.derivativesVolume.enabled .Values.derivativesVolume.existingClaim }} persistentVolumeClaim: claimName: {{ .Values.derivativesVolume.existingClaim }} {{- else if .Values.derivativesVolume.enabled }} persistentVolumeClaim: claimName: {{ template "hyrax.fullname" . }}-derivatives {{ else }} emptyDir: {} {{ end }} - name: "uploads" {{- if and .Values.uploadsVolume.enabled .Values.uploadsVolume.existingClaim }} persistentVolumeClaim: claimName: {{ .Values.uploadsVolume.existingClaim }} {{- else if .Values.uploadsVolume.enabled }} persistentVolumeClaim: claimName: {{ template "hyrax.fullname" . }}-uploads {{ else }} emptyDir: {} {{ end }} {{- if .Values.applicationExistingClaim }} - name: "application" persistentVolumeClaim: claimName: {{ .Values.applicationExistingClaim }} {{- end }} {{- with .Values.worker.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.worker.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.worker.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.worker.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}