feat: add helm chart for deploying the app on k8s
This commit is contained in:
parent
aaa1eff0fe
commit
cbaa5272ef
13 changed files with 261 additions and 0 deletions
46
deploy/k8s/templates/migration-job.yaml
Normal file
46
deploy/k8s/templates/migration-job.yaml
Normal 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
|
||||
Reference in a new issue