blob: 84c0bc7b2a18a4fa19178ad0f8586068443fd8cd [file] [log] [blame]
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "common.names.fullname" . }}-seeder-{{ now | date "20060102150405" }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- with .Values.seederJob.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ttlSecondsAfterFinished: 6000
template:
metadata:
labels:
{{- include "common.labels.standard" . | nindent 8 }}
openproject/process: seeder
{{- with .Values.seederJob.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "openproject.imagePullSecrets" . | indent 6 }}
{{- include "openproject.podSecurityContext" . | indent 6 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | nindent 8 | trim }}
{{- end }}
volumes:
{{- include "openproject.tmpVolumeSpec" . | indent 8 }}
{{- if .Values.persistence.enabled }}
- name: "data"
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ include "common.names.fullname" . }}{{- end }}
{{- end }}
initContainers:
- name: check-db-ready
image: "{{ .Values.initdb.image.registry }}/{{ .Values.initdb.image.repository }}:{{ .Values.initdb.image.tag }}"
imagePullPolicy: {{ .Values.initdb.image.imagePullPolicy }}
command: [
'sh',
'-c',
'until pg_isready -h $DATABASE_HOST -p $DATABASE_PORT -U {{ .Values.postgresql.auth.username }}; do echo "waiting for database $DATABASE_HOST:$DATABASE_PORT"; sleep 2; done;'
]
envFrom:
{{- include "openproject.envFrom" . | nindent 12 }}
env:
{{- include "openproject.env" . | nindent 12 }}
resources:
{{- toYaml .Values.initdb.resources | nindent 12 }}
{{- include "openproject.containerSecurityContext" . | indent 10 }}
containers:
- name: seeder
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}{{ if .Values.image.sha256 }}@sha256:{{ .Values.image.sha256 }}{{ else }}:{{ .Values.image.tag }}{{ end }}"
imagePullPolicy: {{ .Values.image.imagePullPolicy }}
args:
- bash
- /app/docker/prod/seeder
envFrom:
{{- include "openproject.envFrom" . | nindent 12 }}
env:
{{- include "openproject.env" . | nindent 12 }}
volumeMounts:
{{- include "openproject.tmpVolumeMounts" . | indent 12 }}
{{- if .Values.persistence.enabled }}
- name: "data"
mountPath: "/var/openproject/assets"
{{- end }}
{{- include "openproject.containerSecurityContext" . | indent 10 }}
restartPolicy: OnFailure