Files
chart/templates/migrations-job.yaml
Konstantin Grachev 2324e7d6e2
All checks were successful
continuous-integration/drone/push Build is passing
cs: fix
2023-03-17 17:00:07 +03:00

54 lines
1.6 KiB
YAML

{{- if .Values.migrations.image.repository }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "hasura.fullname" . }}-migrations
labels:
{{- include "hasura.labels" . | nindent 4 }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
spec:
template:
metadata:
name: {{ include "hasura.fullname" . }}-migrations
labels:
{{- include "hasura.labels" . | nindent 8 }}
spec:
{{- with .Values.migrations.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: Never
volumes:
- name: data
emptyDir: {}
initContainers:
- name: copy
image: "{{ .Values.migrations.image.registry }}/{{ .Values.migrations.image.repository }}:{{ .Values.migrations.image.tag | default "latest" }}"
command: ["/bin/sh", "-c", "cp -R /{{ .Values.migrations.image.path }}/* /shared-data/"]
workingDir: /data
volumeMounts:
- name: data
mountPath: /shared-data
containers:
- name: migrate
image: {{ include "hasura.image" . }}
command: ["/bin/sh", "-c"]
args:
- hasura-cli deploy
workingDir: /data
env:
- name: HASURA_GRAPHQL_ENDPOINT
value: "http://{{ include "hasura.fullname" . }}"
envFrom:
{{- if .Values.extraEnvVarsSecret }}
- secretRef:
name: {{ .Values.extraEnvVarsSecret }}
{{- end }}
volumeMounts:
- name: data
mountPath: /data
{{- end }}