1
0
Fork 0

refactor(deploy): mount database_url.txt as file and run migrate command in shell under /bin/ash -c

This commit is contained in:
Vojtěch Mareš 2024-06-27 21:37:19 +02:00
parent 11cc2027b8
commit 0904448966
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D

View file

@ -25,17 +25,22 @@ spec:
containers:
- name: migrations
image: "{{ .Values.migrations.image.repository }}:{{ .Values.migrations.image.tag }}"
command: ["/usr/local/bin/migrate"]
args: ["-path", "/srv/migrations/", "-database", "$MIGRATE_DATABASE_URL", "up"]
env:
- name: MIGRATE_DATABASE_URL
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}
key: "database_url.txt"
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