See changelog
This commit is contained in:
parent
af39eedea8
commit
74288199f6
13 changed files with 71 additions and 19 deletions
72
templates/migrate-job.yaml
Normal file
72
templates/migrate-job.yaml
Normal file
|
@ -0,0 +1,72 @@
|
|||
{{- if .Values.migrationJob.enabled -}}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ include "django.fullname" . }}-migrate
|
||||
labels:
|
||||
{{- include "django.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,pre-upgrade
|
||||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
||||
"helm.sh/hook-weight": "0"
|
||||
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
|
||||
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
tag: "{{ .Values.image.tag }}"
|
||||
spec:
|
||||
activeDeadlineSeconds: {{ default 900 .Values.migrationJob.activeDeadlineSeconds }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: migrate-job
|
||||
{{- include "django.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "django.serviceAccountName" . }}
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: migrate-job
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.migrationJob.resources }}
|
||||
resources: {{ toYaml .Values.migrationJob.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
command: {{ .Values.migrationJob.command | default (list "./manage.py" "migrate") | toJson }}
|
||||
env:
|
||||
- name: DEBUG
|
||||
value: "False"
|
||||
{{- if .Values.env.secret.DATABASE_URL }}
|
||||
- name: DATABASE_URL
|
||||
value: {{ .Values.env.secret.DATABASE_URL }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ default (include "django.postgresql.fullname" .) .Values.postgresql.auth.existingSecret }}
|
||||
key: postgres-password
|
||||
{{- end }}
|
||||
- name: SECRET_KEY
|
||||
value: {{ required "env.secret.SECRET_KEY is a required value." .Values.env.secret.SECRET_KEY }}
|
||||
{{- range $k, $v := .Values.env.normal }}
|
||||
- name: {{ $k }}
|
||||
value: {{ $v | quote }}
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "django.fullname" . }}
|
||||
{{- with .Values.extraVolumeMounts }}
|
||||
volumeMounts:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraVolumes }}
|
||||
volumes:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
Reference in a new issue