Skip to content

Commit

Permalink
feat: Add migration
Browse files Browse the repository at this point in the history
Add the migration feature.
  • Loading branch information
colinjfw committed Sep 7, 2019
1 parent 9387304 commit 10d3007
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions charts/app/templates/migration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.migrate.enabled -}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "app.fullname" . }}-migrate
namespace: {{ .Release.Namespace }}
labels:
{{ include "app.labels" . | indent 4 }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/hook-weight": "0"
spec:
template:
metadata:
labels:
app.kubernetes.io/component: migrate
{{ include "app.matchLabels" . | indent 8 }}
spec:
restartPolicy: Never
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
command: ["/bin/sh"]
args: ["-c", "{{ .Values.migrate.command }}"]
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ include "app.fullname" $ }}
{{ with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end -}}

0 comments on commit 10d3007

Please # to comment.