| gio | c916187 | 2024-04-21 10:46:35 +0400 | [diff] [blame] | 1 | apiVersion: batch/v1 |
| 2 | kind: Job |
| 3 | metadata: |
| 4 | name: {{ include "common.names.fullname" . }}-seeder-{{ now | date "20060102150405" }} |
| 5 | labels: |
| 6 | {{- include "common.labels.standard" . | nindent 4 }} |
| 7 | {{- with .Values.seederJob.annotations }} |
| 8 | annotations: |
| 9 | {{- toYaml . | nindent 4 }} |
| 10 | {{- end }} |
| 11 | spec: |
| 12 | ttlSecondsAfterFinished: 6000 |
| 13 | template: |
| 14 | metadata: |
| 15 | labels: |
| 16 | {{- include "common.labels.standard" . | nindent 8 }} |
| 17 | openproject/process: seeder |
| 18 | {{- with .Values.seederJob.annotations }} |
| 19 | annotations: |
| 20 | {{- toYaml . | nindent 8 }} |
| 21 | {{- end }} |
| 22 | spec: |
| 23 | {{- include "openproject.imagePullSecrets" . | indent 6 }} |
| 24 | {{- include "openproject.podSecurityContext" . | indent 6 }} |
| 25 | {{- with .Values.nodeSelector }} |
| 26 | nodeSelector: |
| 27 | {{ toYaml . | nindent 8 | trim }} |
| 28 | {{- end }} |
| 29 | volumes: |
| 30 | {{- include "openproject.tmpVolumeSpec" . | indent 8 }} |
| 31 | {{- if .Values.persistence.enabled }} |
| 32 | - name: "data" |
| 33 | persistentVolumeClaim: |
| 34 | claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ include "common.names.fullname" . }}{{- end }} |
| 35 | {{- end }} |
| 36 | initContainers: |
| 37 | - name: check-db-ready |
| 38 | image: "{{ .Values.initdb.image.registry }}/{{ .Values.initdb.image.repository }}:{{ .Values.initdb.image.tag }}" |
| 39 | imagePullPolicy: {{ .Values.initdb.image.imagePullPolicy }} |
| 40 | command: [ |
| 41 | 'sh', |
| 42 | '-c', |
| 43 | '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;' |
| 44 | ] |
| 45 | envFrom: |
| 46 | {{- include "openproject.envFrom" . | nindent 12 }} |
| 47 | env: |
| 48 | {{- include "openproject.env" . | nindent 12 }} |
| 49 | resources: |
| 50 | {{- toYaml .Values.initdb.resources | nindent 12 }} |
| 51 | {{- include "openproject.containerSecurityContext" . | indent 10 }} |
| 52 | containers: |
| 53 | - name: seeder |
| 54 | image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}{{ if .Values.image.sha256 }}@sha256:{{ .Values.image.sha256 }}{{ else }}:{{ .Values.image.tag }}{{ end }}" |
| 55 | imagePullPolicy: {{ .Values.image.imagePullPolicy }} |
| 56 | args: |
| 57 | - bash |
| 58 | - /app/docker/prod/seeder |
| 59 | envFrom: |
| 60 | {{- include "openproject.envFrom" . | nindent 12 }} |
| 61 | env: |
| 62 | {{- include "openproject.env" . | nindent 12 }} |
| 63 | volumeMounts: |
| 64 | {{- include "openproject.tmpVolumeMounts" . | indent 12 }} |
| 65 | {{- if .Values.persistence.enabled }} |
| 66 | - name: "data" |
| 67 | mountPath: "/var/openproject/assets" |
| 68 | {{- end }} |
| 69 | {{- include "openproject.containerSecurityContext" . | indent 10 }} |
| 70 | restartPolicy: OnFailure |