Use docker image as a container for migrations files instead of git

This commit is contained in:
2022-03-21 12:44:55 +03:00
parent b5aa8c5b6c
commit bba7e0c23f
3 changed files with 15 additions and 31 deletions

View File

@ -2,6 +2,6 @@ apiVersion: v2
name: hasura
description: A Helm chart for Kubernetes
type: application
version: 0.1.12
version: 0.2.0
appVersion: v2.3.1
icon: https://raw.githubusercontent.com/hasura/graphql-engine/master/assets/brand/powered_by_hasura_primary_lightbg.svg

View File

@ -1,4 +1,4 @@
{{- if .Values.migrations.enabled }}
{{- if .Values.migrations.image.repository }}
apiVersion: batch/v1
kind: Job
metadata:
@ -20,32 +20,18 @@ spec:
volumes:
- name: data
emptyDir: { }
- name: ssh-key
secret:
secretName: {{ quote .Values.migrations.git.sshKeySecret }}
defaultMode: 0400
initContainers:
- name: git-clone
image: {{ .Values.migrations.git.image }}
command: [ "/bin/sh", "-c" ]
args:
- set -ex;
if [ ! -d .git ]; then
git init --quiet;
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
- name: copy
image: "{{ .Values.migrations.image.registry }}/{{ .Values.migrations.image.repository }}:{{ .Values.migrations.image.tag | default "latest" }}"
command:
- cp
- -R
- *
- /shared/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:
- name: data
mountPath: /data
- name: ssh-key
readOnly: true
mountPath: '/.ssh'
mountPath: /shared-data
containers:
- name: migrate
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"

View File

@ -13,13 +13,11 @@ image:
extraEnvVarsSecret: ""
migrations:
enabled: false
git:
image: alpine/git:v2.32.0
sshKeySecret: ""
repo: ""
branch: master
commit: ""
# Docker image which contain migrations,metadata,config.yml inside /data directory
image:
registry: docker.io
repository: ""
tag: ""
imagePullSecrets: [ ]
nameOverride: ""