Use docker image as a container for migrations files instead of git
This commit is contained in:
@ -2,6 +2,6 @@ apiVersion: v2
|
|||||||
name: hasura
|
name: hasura
|
||||||
description: A Helm chart for Kubernetes
|
description: A Helm chart for Kubernetes
|
||||||
type: application
|
type: application
|
||||||
version: 0.1.12
|
version: 0.2.0
|
||||||
appVersion: v2.3.1
|
appVersion: v2.3.1
|
||||||
icon: https://raw.githubusercontent.com/hasura/graphql-engine/master/assets/brand/powered_by_hasura_primary_lightbg.svg
|
icon: https://raw.githubusercontent.com/hasura/graphql-engine/master/assets/brand/powered_by_hasura_primary_lightbg.svg
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{- if .Values.migrations.enabled }}
|
{{- if .Values.migrations.image.repository }}
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
@ -20,32 +20,18 @@ spec:
|
|||||||
volumes:
|
volumes:
|
||||||
- name: data
|
- name: data
|
||||||
emptyDir: { }
|
emptyDir: { }
|
||||||
- name: ssh-key
|
|
||||||
secret:
|
|
||||||
secretName: {{ quote .Values.migrations.git.sshKeySecret }}
|
|
||||||
defaultMode: 0400
|
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: git-clone
|
- name: copy
|
||||||
image: {{ .Values.migrations.git.image }}
|
image: "{{ .Values.migrations.image.registry }}/{{ .Values.migrations.image.repository }}:{{ .Values.migrations.image.tag | default "latest" }}"
|
||||||
command: [ "/bin/sh", "-c" ]
|
command:
|
||||||
args:
|
- cp
|
||||||
- set -ex;
|
- -R
|
||||||
if [ ! -d .git ]; then
|
- *
|
||||||
git init --quiet;
|
- /shared/data
|
||||||
git remote add origin {{ .Values.migrations.git.repo }};
|
|
||||||
git fetch origin +refs/heads/{{ .Values.migrations.git.branch }};
|
|
||||||
git checkout {{ .Values.migrations.git.commit }} -b {{ .Values.migrations.git.branch }};
|
|
||||||
fi
|
|
||||||
workingDir: /data
|
workingDir: /data
|
||||||
env:
|
|
||||||
- name: GIT_SSH_COMMAND
|
|
||||||
value: ssh -i /.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data
|
mountPath: /shared-data
|
||||||
- name: ssh-key
|
|
||||||
readOnly: true
|
|
||||||
mountPath: '/.ssh'
|
|
||||||
containers:
|
containers:
|
||||||
- name: migrate
|
- name: migrate
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
12
values.yaml
12
values.yaml
@ -13,13 +13,11 @@ image:
|
|||||||
extraEnvVarsSecret: ""
|
extraEnvVarsSecret: ""
|
||||||
|
|
||||||
migrations:
|
migrations:
|
||||||
enabled: false
|
# Docker image which contain migrations,metadata,config.yml inside /data directory
|
||||||
git:
|
image:
|
||||||
image: alpine/git:v2.32.0
|
registry: docker.io
|
||||||
sshKeySecret: ""
|
repository: ""
|
||||||
repo: ""
|
tag: ""
|
||||||
branch: master
|
|
||||||
commit: ""
|
|
||||||
|
|
||||||
imagePullSecrets: [ ]
|
imagePullSecrets: [ ]
|
||||||
nameOverride: ""
|
nameOverride: ""
|
||||||
|
Reference in New Issue
Block a user