--- apiVersion: batch/v1 kind: Job metadata: name: {{ include "ocrserver.fullname" . }}-downloader labels: {{- include "ocrserver.labels" . | nindent 4 }} annotations: "helm.sh/hook": pre-install,pre-upgrade "helm.sh/hook-weight": "5" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded spec: template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "ocrserver.labels" . | nindent 8 }} app.kubernetes.io/component: languages-downloader {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "ocrserver.serviceAccountName" . }} {{- with .Values.podSecurityContext }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} restartPolicy: OnFailure containers: - name: {{ .Chart.Name }} {{- with .Values.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.image }} image: "{{ .registry }}/{{ .repository }}:{{ .tag }}" imagePullPolicy: {{ .pullPolicy }} {{- end }} command: [ "sh" ] args: - -c - | apt-get update apt-get install -y {{- range $lang := .Values.languagedownloader.languages }} tesseract-ocr-{{ $lang }}{{- end }} {{- with .Values.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.readinessProbe }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: - mountPath: /usr/share/tesseract-ocr/4.00/tessdata/ name: languages {{- with .Values.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} volumes: - name: languages {{- if $.Values.persistence.hostPath }} hostPath: type: Directory path: {{ $.Values.persistence.hostPath | quote }} {{- else if $.Values.persistence.enabled }} persistentVolumeClaim: claimName: {{ with $.Values.persistence.existingClaim }}{{ . }}{{- else }}{{ template "ocrserver.fullname" $ }}{{- end }} {{- else }} emptyDir: {} {{- end }} {{- with .Values.volumes }} {{- toYaml . | nindent 8 }} {{- 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 }}