|
{{- if .Values.migrationJob.enabled }} |
|
|
|
apiVersion: batch/v1 |
|
kind: Job |
|
metadata: |
|
name: {{ include "litellm.fullname" . }}-migrations |
|
annotations: |
|
argocd.argoproj.io/hook: PreSync |
|
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation |
|
checksum/config: {{ toYaml .Values | sha256sum }} |
|
spec: |
|
template: |
|
metadata: |
|
annotations: |
|
{{- with .Values.migrationJob.annotations }} |
|
{{- toYaml . | nindent 8 }} |
|
{{- end }} |
|
spec: |
|
containers: |
|
- name: prisma-migrations |
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "main-%s" .Chart.AppVersion) }}" |
|
imagePullPolicy: {{ .Values.image.pullPolicy }} |
|
securityContext: |
|
{{- toYaml .Values.securityContext | nindent 12 }} |
|
command: ["python", "litellm/proxy/prisma_migration.py"] |
|
workingDir: "/app" |
|
env: |
|
{{- if .Values.db.useExisting }} |
|
- name: DATABASE_USERNAME |
|
valueFrom: |
|
secretKeyRef: |
|
name: {{ .Values.db.secret.name }} |
|
key: {{ .Values.db.secret.usernameKey }} |
|
- name: DATABASE_PASSWORD |
|
valueFrom: |
|
secretKeyRef: |
|
name: {{ .Values.db.secret.name }} |
|
key: {{ .Values.db.secret.passwordKey }} |
|
- name: DATABASE_HOST |
|
value: {{ .Values.db.endpoint }} |
|
- name: DATABASE_NAME |
|
value: {{ .Values.db.database }} |
|
- name: DATABASE_URL |
|
value: {{ .Values.db.url | quote }} |
|
{{- else }} |
|
- name: DATABASE_URL |
|
value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Release.Name }}-postgresql/{{ .Values.postgresql.auth.database }} |
|
{{- end }} |
|
- name: DISABLE_SCHEMA_UPDATE |
|
value: "false" |
|
restartPolicy: OnFailure |
|
backoffLimit: {{ .Values.migrationJob.backoffLimit }} |
|
{{- end }} |
|
|