Files
chart/templates/migrations-job.yaml
Konstantin Grachev a801fd1480
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Fix include number of args
2022-12-06 16:03:53 +03:00

54 lines
1.7 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 }}