fix(ocrserver): try language downloader
This commit is contained in:
parent
c6c1b4a04c
commit
14df2e5633
8 changed files with 238 additions and 9 deletions
|
@ -2,7 +2,7 @@ apiVersion: v2
|
|||
name: ocrserver
|
||||
description: Run OCR-Server
|
||||
type: application
|
||||
version: "0.1.0"
|
||||
version: "0.2.0"
|
||||
# renovate: image=otiai10/ocrserver
|
||||
appVersion: "1.1.0"
|
||||
maintainers:
|
||||
|
|
|
@ -7,7 +7,7 @@ description: "Run OCR-Server"
|
|||
|
||||
# ocrserver
|
||||
|
||||
  
|
||||
  
|
||||
|
||||
Run OCR-Server
|
||||
|
||||
|
@ -73,10 +73,19 @@ helm uninstall ocrserver-release
|
|||
| ingress.hosts[0].paths[0].path | string | `"/"` | |
|
||||
| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
|
||||
| ingress.tls | list | `[]` | |
|
||||
| languagedownloader.enabled | bool | `true` | |
|
||||
| languagedownloader.languages[0] | string | `"deu"` | |
|
||||
| livenessProbe.httpGet.path | string | `"/status"` | |
|
||||
| livenessProbe.httpGet.port | string | `"http"` | |
|
||||
| nameOverride | string | `""` | This is to override the chart name. |
|
||||
| nodeSelector | object | `{}` | |
|
||||
| persistence.accessMode | string | `"ReadWriteOnce"` | |
|
||||
| persistence.annotations | object | `{}` | |
|
||||
| persistence.enabled | bool | `true` | |
|
||||
| persistence.existingClaim | string | `nil` | A manually managed Persistent Volume and Claim Requires persistence.enabled: true If defined, PVC must be created manually before volume will be bound |
|
||||
| persistence.hostPath | string | `nil` | Do not create an PVC, direct use hostPath in Pod |
|
||||
| persistence.size | string | `"5Gi"` | |
|
||||
| persistence.storageClass | string | `nil` | Persistent Volume Storage Class If defined, storageClassName: <storageClass> If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. (gp2 on AWS, standard on GKE, AWS & OpenStack) |
|
||||
| podAnnotations | object | `{}` | This is for setting Kubernetes Annotations to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ |
|
||||
| podLabels | object | `{}` | This is for setting Kubernetes Labels to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ |
|
||||
| podSecurityContext | object | `{}` | |
|
||||
|
@ -98,7 +107,7 @@ helm uninstall ocrserver-release
|
|||
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs)
|
||||
# ocrserver
|
||||
|
||||
  
|
||||
  
|
||||
|
||||
Run OCR-Server
|
||||
|
||||
|
@ -142,10 +151,19 @@ Run OCR-Server
|
|||
| ingress.hosts[0].paths[0].path | string | `"/"` | |
|
||||
| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
|
||||
| ingress.tls | list | `[]` | |
|
||||
| languagedownloader.enabled | bool | `true` | |
|
||||
| languagedownloader.languages[0] | string | `"deu"` | |
|
||||
| livenessProbe.httpGet.path | string | `"/status"` | |
|
||||
| livenessProbe.httpGet.port | string | `"http"` | |
|
||||
| nameOverride | string | `""` | This is to override the chart name. |
|
||||
| nodeSelector | object | `{}` | |
|
||||
| persistence.accessMode | string | `"ReadWriteOnce"` | |
|
||||
| persistence.annotations | object | `{}` | |
|
||||
| persistence.enabled | bool | `true` | |
|
||||
| persistence.existingClaim | string | `nil` | A manually managed Persistent Volume and Claim Requires persistence.enabled: true If defined, PVC must be created manually before volume will be bound |
|
||||
| persistence.hostPath | string | `nil` | Do not create an PVC, direct use hostPath in Pod |
|
||||
| persistence.size | string | `"5Gi"` | |
|
||||
| persistence.storageClass | string | `nil` | Persistent Volume Storage Class If defined, storageClassName: <storageClass> If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. (gp2 on AWS, standard on GKE, AWS & OpenStack) |
|
||||
| podAnnotations | object | `{}` | This is for setting Kubernetes Annotations to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ |
|
||||
| podLabels | object | `{}` | This is for setting Kubernetes Labels to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ |
|
||||
| podSecurityContext | object | `{}` | |
|
||||
|
|
|
@ -19,6 +19,7 @@ spec:
|
|||
{{- end }}
|
||||
labels:
|
||||
{{- include "ocrserver.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: server
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
@ -42,6 +43,14 @@ spec:
|
|||
image: "{{ .registry }}/{{ .repository }}:{{ .tag }}"
|
||||
imagePullPolicy: {{ .pullPolicy }}
|
||||
{{- end }}
|
||||
command: [ "sh" ]
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
{{- range $lang := .Values.languagedownloader.languages }}
|
||||
ln -s /data/{{ $lang }}.traineddata /usr/share/tesseract-ocr/4.00/tessdata/{{ $lang }}.traineddata
|
||||
{{- end }}
|
||||
ocrserver
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
|
@ -58,14 +67,27 @@ spec:
|
|||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.volumeMounts }}
|
||||
volumeMounts:
|
||||
- mountPath: /data
|
||||
name: languages
|
||||
{{- with .Values.volumeMounts }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.volumes }}
|
||||
{{- 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 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
|
|
96
ocrserver/templates/job.yaml
Normal file
96
ocrserver/templates/job.yaml
Normal file
|
@ -0,0 +1,96 @@
|
|||
---
|
||||
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 }}
|
|
@ -11,6 +11,7 @@ spec:
|
|||
podSelector:
|
||||
matchLabels:
|
||||
{{- include "ocrserver.selectorLabels" $ | nindent 6 }}
|
||||
app.kubernetes.io/component: server
|
||||
policyTypes:
|
||||
- Ingress
|
||||
{{- if .egress.enabled }}
|
||||
|
@ -25,6 +26,36 @@ spec:
|
|||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}{{/* end-with .ingress.http */}}
|
||||
|
||||
{{- with .egress }}
|
||||
{{- if .enabled }}
|
||||
egress:
|
||||
{{- with .extra }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}{{/* end-if egress.enabled */}}
|
||||
{{- end }}{{/* end-with .egress */}}
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: {{ include "ocrserver.fullname" $ }}-languagedownloader
|
||||
labels:
|
||||
{{- include "ocrserver.labels" $ | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install,pre-upgrade
|
||||
"helm.sh/hook-weight": "5"
|
||||
"helm.sh/hook-delete-policy": hook-failed
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
{{- include "ocrserver.selectorLabels" $ | nindent 6 }}
|
||||
app.kubernetes.io/component: languages-downloader
|
||||
policyTypes:
|
||||
- Ingress
|
||||
{{- if .egress.enabled }}
|
||||
- Egress
|
||||
{{- end }}
|
||||
|
||||
{{- with .egress }}
|
||||
{{- if .enabled }}
|
||||
egress:
|
||||
|
|
32
ocrserver/templates/pvc.yaml
Normal file
32
ocrserver/templates/pvc.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
{{- if and
|
||||
.Values.persistence.enabled
|
||||
(not .Values.persistence.hostPath)
|
||||
(not .Values.persistence.existingClaim)
|
||||
}}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "ocrserver.fullname" . }}
|
||||
labels:
|
||||
{{- include "ocrserver.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install
|
||||
"helm.sh/hook-weight": "5"
|
||||
"helm.sh/hook-delete-policy": hook-failed
|
||||
{{- with .Values.persistence.annotations }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- with .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
|
@ -5,9 +5,12 @@ metadata:
|
|||
name: {{ include "ocrserver.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "ocrserver.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install
|
||||
"helm.sh/hook-weight": "5"
|
||||
"helm.sh/hook-delete-policy": hook-failed
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
|
||||
{{- end }}
|
||||
|
|
|
@ -114,6 +114,33 @@ networkPolicy:
|
|||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
|
||||
languagedownloader:
|
||||
enabled: true
|
||||
languages:
|
||||
- "deu"
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
annotations: {}
|
||||
# -- Persistent Volume Storage Class
|
||||
# If defined, storageClassName: <storageClass>
|
||||
# If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
# If undefined (the default) or set to null, no storageClassName spec is
|
||||
# set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
# GKE, AWS & OpenStack)
|
||||
#
|
||||
storageClass:
|
||||
|
||||
# -- A manually managed Persistent Volume and Claim
|
||||
# Requires persistence.enabled: true
|
||||
# If defined, PVC must be created manually before volume will be bound
|
||||
existingClaim:
|
||||
|
||||
# -- Do not create an PVC, direct use hostPath in Pod
|
||||
hostPath:
|
||||
accessMode: ReadWriteOnce
|
||||
size: 5Gi
|
||||
|
||||
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
|
||||
autoscaling:
|
||||
enabled: false
|
||||
|
|
Loading…
Add table
Reference in a new issue