{{- 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 }}