datalab/helm-charts-datalab/doccano/templates/deployment.yaml

88 lines
3.0 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Release.Name }}-{{ .Values.image.name }}"
labels:
app: "{{ .Release.Name }}-{{ .Values.image.name }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{ include "doccano.labels" . | indent 4 }}
spec:
strategy:
type: Recreate
replicas: {{ .Values.image.replicaCount }}
selector:
matchLabels:
app: "{{ .Release.Name }}-{{ .Values.image.name }}"
release: {{ .Release.Name }}
template:
metadata:
labels:
app: "{{ .Release.Name }}-{{ .Values.image.name }}"
release: {{ .Release.Name }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
containers:
- args:
- /bin/bash
- /config/bootstrap.sh
env:
- name: ADMIN_EMAIL
value: {{ .Values.env.ADMIN_EMAIL }}
- name: ADMIN_USERNAME
value: {{ .Values.env.ADMIN_USERNAME }}
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: ADMIN_PASSWORD
name: doccano-password
optional: false
- name: DATABASE_URL
value: "postgres://{{ .Values.postgresql.global.postgresql.auth.username }}:{{ .Values.postgresql.global.postgresql.auth.password }}@{{ include "doccano.postgres_host" . }}:5432/{{ .Values.postgresql.global.postgresql.auth.database }}?sslmode=disable"
{{- if .Values.extraEnv }}
{{- with .Values.extraEnv }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
name: {{ .Values.image.name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.targetPort }}
name: {{ .Values.service.targetPort }}{{ .Values.service.protocol | lower }}
protocol: {{ .Values.service.protocol }}
volumeMounts:
- mountPath: {{ .Values.persistence.mountPath }}
name: {{ .Values.persistence.volumeName }}
- mountPath: /config
name: bootstrap
initContainers:
- args:
- chown
- "1000:1000"
- {{ .Values.persistence.mountPath }}
image: busybox
imagePullPolicy: IfNotPresent
name: chmod
volumeMounts:
- mountPath: {{ .Values.persistence.mountPath }}
name: {{ .Values.persistence.volumeName }}
volumes:
- configMap:
defaultMode: 0777
items:
- key: bootstrap.sh
path: ./bootstrap.sh
name: {{ .Release.Name }}-conf
optional: false
name: bootstrap
- name: {{ .Values.persistence.volumeName }}
persistentVolumeClaim:
claimName: "{{ .Release.Name }}-{{ .Values.persistence.volumeName }}"
{{- if .Values.image.deployRegistry }}
imagePullSecrets:
- name: "{{ .Values.image.name }}-{{ .Values.image.imagePullSecrets }}"
{{- end }}