From 0904448966fcc941357d94cce5ee088d5ad8846f Mon Sep 17 00:00:00 2001 From: Vojtech Mares Date: Thu, 27 Jun 2024 21:37:19 +0200 Subject: [PATCH] refactor(deploy): mount database_url.txt as file and run migrate command in shell under /bin/ash -c --- deploy/templates/migration-job.yaml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/deploy/templates/migration-job.yaml b/deploy/templates/migration-job.yaml index 9f19423..8ea39ba 100644 --- a/deploy/templates/migration-job.yaml +++ b/deploy/templates/migration-job.yaml @@ -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