1
0
Fork 0

feat: add helm chart for deploying the app on k8s

This commit is contained in:
Vojtěch Mareš 2024-10-10 21:30:23 +02:00
parent aaa1eff0fe
commit cbaa5272ef
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
13 changed files with 261 additions and 0 deletions

View file

@ -0,0 +1,46 @@
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/backoffice-api/secrets/database_url) up
{{- with .Values.migrations.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /etc/backoffice-api/secrets
name: secrets
readOnly: true
volumes:
- name: secrets
secret:
secretName: {{ .Release.Name }}-migrations
restartPolicy: Never
backoffLimit: 0