mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
122 lines
4.5 KiB
YAML
122 lines
4.5 KiB
YAML
{{- if .Values.migrationJob.enabled }}
|
|
# This job runs the Prisma migrations for the LiteLLM DB.
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: {{ include "litellm.fullname" . }}-migrations
|
|
labels:
|
|
{{- include "litellm.labels" . | nindent 4 }}
|
|
{{- with .Values.migrationJob.jobLabels }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
annotations:
|
|
{{- if .Values.migrationJob.hooks.argocd.enabled }}
|
|
argocd.argoproj.io/hook: PreSync
|
|
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
|
|
{{- end }}
|
|
{{- if .Values.migrationJob.hooks.helm.enabled }}
|
|
helm.sh/hook: "pre-install,pre-upgrade"
|
|
helm.sh/hook-delete-policy: "before-hook-creation"
|
|
helm.sh/hook-weight: {{ .Values.migrationJob.hooks.helm.weight | default "1" | quote }}
|
|
{{- end }}
|
|
checksum/config: {{ toYaml .Values | sha256sum }}
|
|
{{- with .Values.migrationJob.jobAnnotations }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "litellm.labels" . | nindent 8 }}
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.migrationJob.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
annotations:
|
|
{{- with .Values.migrationJob.annotations }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "litellm.migrationServiceAccountName" . }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
{{- with .Values.migrationJob.extraInitContainers }}
|
|
initContainers:
|
|
{{- tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: prisma-migrations
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
{{- if .Values.migrationJob.command }}
|
|
command: {{ toYaml .Values.migrationJob.command | nindent 12 }}
|
|
{{- else }}
|
|
command: ["python", "litellm/proxy/prisma_migration.py"]
|
|
{{- end }}
|
|
{{- if .Values.migrationJob.args }}
|
|
args: {{ toYaml .Values.migrationJob.args | nindent 12 }}
|
|
{{- else if .Values.migrationJob.command }}
|
|
args: []
|
|
{{- end }}
|
|
workingDir: "/app"
|
|
env:
|
|
{{- include "litellm.validateDbTokenAuth" . -}}
|
|
{{- if .Values.db.useExisting }}
|
|
{{- include "litellm.existingDbEnv" . | nindent 12 }}
|
|
{{- else if .Values.db.deployStandalone }}
|
|
- name: DATABASE_URL
|
|
value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Release.Name }}-postgresql/{{ .Values.postgresql.auth.database }}
|
|
{{- end }}
|
|
{{- if .Values.envVars }}
|
|
{{- range $key, $val := .Values.envVars }}
|
|
- name: {{ $key }}
|
|
value: {{ $val | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.extraEnvVars }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
- name: DISABLE_SCHEMA_UPDATE
|
|
value: "false" # always run the migration from the Helm PreSync hook, override the value set
|
|
{{- with .Values.volumeMounts }}
|
|
volumeMounts:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.migrationJob.resources }}
|
|
resources:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.migrationJob.extraContainers }}
|
|
{{- tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.volumes }}
|
|
volumes:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
restartPolicy: OnFailure
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
ttlSecondsAfterFinished: {{ .Values.migrationJob.ttlSecondsAfterFinished }}
|
|
backoffLimit: {{ .Values.migrationJob.backoffLimit }}
|
|
{{- with .Values.migrationJob.activeDeadlineSeconds }}
|
|
activeDeadlineSeconds: {{ . }}
|
|
{{- end }}
|
|
{{- end }}
|