Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

(feat) helm hook to sync db schema (#6715)

Ishaan Jaff688d51345931
diff --git a/deploy/charts/litellm-helm/templates/migrations-job.yaml b/deploy/charts/litellm-helm/templates/migrations-job.yaml
new file mode 100644
index 00000000000..7f2cc0aebe5
--- /dev/null
+++ b/deploy/charts/litellm-helm/templates/migrations-job.yaml
@@ -0,0 +1,27 @@
+"""
+This job runs the prisma migrations for the LiteLLM DB.
+"""
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ include "litellm.fullname" . }}-migrations
+ annotations:
+ "helm.sh/hook": pre-install,pre-upgrade
+ "helm.sh/hook-weight": "0"
+spec:
+ template:
+ spec:
+ containers:
+ - name: prisma-migrations
+ image: "ghcr.io/berriai/litellm:main-stable"
+ command: ["python", "/litellm/proxy/prisma_migration.py"]
+ env:
+ - name: DATABASE_URL
+ valueFrom:
+ secretKeyRef:
+ name: {{ .Values.db.secret.name }}
+ key: url
+ - name: DISABLE_SCHEMA_UPDATE
+ value: "{{ .Values.migrationJob.disableSchemaUpdate }}"
+ restartPolicy: OnFailure
+ backoffLimit: {{ .Values.migrationJob.backoffLimit }}
diff --git a/deploy/charts/litellm-helm/values.yaml b/deploy/charts/litellm-helm/values.yaml
index a2c55f2faa8..c8e4aa1f2ec 100644
--- a/deploy/charts/litellm-helm/values.yaml
+++ b/deploy/charts/litellm-helm/values.yaml
@@ -179,3 +179,12 @@ postgresql:
redis:
enabled: false
architecture: standalone
+
+# Prisma migration job settings
+migrationJob:
+ enabled: true # Enable or disable the schema migration Job
+ retries: 3 # Number of retries for the Job in case of failure
+ backoffLimit: 4 # Backoff limit for Job restarts
+ disableSchemaUpdate: false # Skip schema migrations for specific environments. When True, the job will exit with code 0.
+
+