1
0
Fork 0
This repository has been archived on 2025-09-02. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mareshq-yggdrasil/deploy/templates/migration-job.yaml

46 lines
1.6 KiB
YAML

apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-migrations-{{ now | unixEpoch }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "database-migrations"
batch.kubernetes.io/job-name: {{ .Release.Name }}-migrations-{{ now | unixEpoch }}
spec:
ttlSecondsAfterFinished: 604800 # 1 week in seconds
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "database-migrations"
batch.kubernetes.io/job-name: {{ .Release.Name }}-migrations-{{ now | unixEpoch }}
spec:
automountServiceAccountToken: false
{{- with .Values.migrations.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: migrations
image: "{{ .Values.migrations.image.repository }}:{{ .Values.migrations.image.tag }}"
command: ["/bin/ash"]
args:
- -c
- |
migrate -path /srv/migrations -database $(cat /etc/yggdrasil/secrets/database_url.txt) up
{{- with .Values.migrations.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /etc/yggdrasil/secrets
name: secrets
readOnly: true
volumes:
- name: secrets
secret:
secretName: {{ .Release.Name }}
restartPolicy: Never
backoffLimit: 0