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 000000000..7f2cc0aeb --- /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 a2c55f2fa..c8e4aa1f2 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. + +