Move helm database migrations to Job

This commit is contained in:
sdarwin
2023-04-10 13:27:19 -06:00
parent d20033c011
commit a0ee73dec3
2 changed files with 33 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
apiVersion: batch/v1
kind: Job
metadata:
name: database-migrations-job
labels:
env: {{ .Values.deploymentEnvironment }}
app: boost
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-1"
spec:
ttlSecondsAfterFinished: 3600
backoffLimit: 4
template:
spec:
restartPolicy: OnFailure
volumes:
{{ toYaml .Values.Volumes | indent 6 }}
imagePullSecrets:
- name: revsys-docker-registry
containers:
- name: database-migrations
image: {{ .Values.Image }}:{{ .Values.ImageTag }}
command: ["/bin/sh", "-c"]
args:
- "./manage.py migrate --noinput"
env:
{{ toYaml .Values.Env | indent 10 }}
volumeMounts:
{{ toYaml .Values.VolumeMounts | indent 10 }}

View File

@@ -15,8 +15,9 @@ replicaCount: "2"
# where necessary
initCommands:
- name: migrate
command: ./manage.py migrate --noinput
# migrate moved to a Job
# - name: migrate
# command: ./manage.py migrate --noinput
- name: collectstatic
command: ./manage.py collectstatic --noinput