|
| 1 | +{{- if .Values.migrations.enabled }} |
| 2 | +apiVersion: batch/v1 |
| 3 | +kind: Job |
| 4 | +metadata: |
| 5 | + name: {{ include "orcha.migrationJobName" . }} |
| 6 | + labels: |
| 7 | + {{- include "orcha.labels" . | nindent 4 }} |
| 8 | + app.kubernetes.io/component: migrations |
| 9 | + annotations: |
| 10 | + "helm.sh/hook": post-install,pre-upgrade |
| 11 | + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded |
| 12 | +spec: |
| 13 | + backoffLimit: {{ .Values.migrations.backoffLimit }} |
| 14 | + {{- with .Values.migrations.ttlSecondsAfterFinished }} |
| 15 | + ttlSecondsAfterFinished: {{ . }} |
| 16 | + {{- end }} |
| 17 | + template: |
| 18 | + metadata: |
| 19 | + labels: |
| 20 | + {{- include "orcha.selectorLabels" . | nindent 8 }} |
| 21 | + app.kubernetes.io/component: migrations |
| 22 | + spec: |
| 23 | + restartPolicy: Never |
| 24 | + {{- if .Values.serviceAccount.create }} |
| 25 | + serviceAccountName: {{ include "orcha.fullname" . }} |
| 26 | + {{- end }} |
| 27 | + {{- with .Values.podSecurityContext }} |
| 28 | + securityContext: |
| 29 | + {{- toYaml . | nindent 8 }} |
| 30 | + {{- end }} |
| 31 | + containers: |
| 32 | + - name: migrations |
| 33 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 34 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 35 | + command: ["/app/.venv/bin/orcha", "migrate"] |
| 36 | + {{- with .Values.securityContext }} |
| 37 | + securityContext: |
| 38 | + {{- toYaml . | nindent 12 }} |
| 39 | + {{- end }} |
| 40 | + env: |
| 41 | + - name: PGUSER |
| 42 | + value: {{ include "orcha.databaseUser" . | quote }} |
| 43 | + - name: PGPASSWORD |
| 44 | + valueFrom: |
| 45 | + secretKeyRef: |
| 46 | + name: {{ include "orcha.dbSecretName" . }} |
| 47 | + key: password |
| 48 | + - name: PGHOST |
| 49 | + value: {{ include "orcha.databaseHost" . | quote }} |
| 50 | + - name: PGPORT |
| 51 | + value: {{ include "orcha.databasePort" . | quote }} |
| 52 | + - name: PGDATABASE |
| 53 | + value: {{ include "orcha.databaseName" . | quote }} |
| 54 | + resources: |
| 55 | + {{- toYaml .Values.migrations.resources | nindent 12 }} |
| 56 | + {{- with .Values.nodeSelector }} |
| 57 | + nodeSelector: |
| 58 | + {{- toYaml . | nindent 8 }} |
| 59 | + {{- end }} |
| 60 | + {{- with .Values.tolerations }} |
| 61 | + tolerations: |
| 62 | + {{- toYaml . | nindent 8 }} |
| 63 | + {{- end }} |
| 64 | + {{- with .Values.affinity }} |
| 65 | + affinity: |
| 66 | + {{- toYaml . | nindent 8 }} |
| 67 | + {{- end }} |
| 68 | +{{- end }} |
0 commit comments