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]

allow helm hooks for migrations job (#13174)

unique-jakub3edb71e617b2
diff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.md
index 31bda3f7d79..cef2b8d162d 100644
--- a/deploy/charts/litellm-helm/README.md
+++ b/deploy/charts/litellm-helm/README.md
@@ -110,6 +110,22 @@ data:
Source: [GitHub Gist from troyharvey](https://gist.github.com/troyharvey/4506472732157221e04c6b15e3b3f094)
+### Migration Job Settings
+
+The migration job supports both ArgoCD and Helm hooks to ensure database migrations run at the appropriate time during deployments.
+
+| Name | Description | Value |
+| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
+| `migrationJob.enabled` | Enable or disable the schema migration Job | `true` |
+| `migrationJob.backoffLimit` | Backoff limit for Job restarts | `4` |
+| `migrationJob.ttlSecondsAfterFinished` | TTL for completed migration jobs | `120` |
+| `migrationJob.annotations` | Additional annotations for the migration job pod | `{}` |
+| `migrationJob.extraContainers` | Additional containers to run alongside the migration job | `[]` |
+| `migrationJob.hooks.argocd.enabled` | Enable ArgoCD hooks for the migration job (uses PreSync hook with BeforeHookCreation delete policy) | `true` |
+| `migrationJob.hooks.helm.enabled` | Enable Helm hooks for the migration job (uses pre-install,pre-upgrade hooks with before-hook-creation delete policy) | `false` |
+| `migrationJob.hooks.helm.weight` | Helm hook execution order (lower weights executed first). Optional - defaults to "1" if not specified. | N/A |
+
+
## Accessing the Admin UI
When browsing to the URL published per the settings in `ingress.*`, you will
be prompted for **Admin Configuration**. The **Proxy Endpoint** is the internal
diff --git a/deploy/charts/litellm-helm/templates/migrations-job.yaml b/deploy/charts/litellm-helm/templates/migrations-job.yaml
index 49176788310..143e62fceb3 100644
--- a/deploy/charts/litellm-helm/templates/migrations-job.yaml
+++ b/deploy/charts/litellm-helm/templates/migrations-job.yaml
@@ -5,8 +5,15 @@ kind: Job
metadata:
name: {{ include "litellm.fullname" . }}-migrations
annotations:
+ {{- if .Values.migrationJob.hooks.argocd.enabled }}
argocd.argoproj.io/hook: PreSync
- argocd.argoproj.io/hook-delete-policy: BeforeHookCreation # delete old migration on a new deploy in case the migration needs to make updates
+ 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 }}
spec:
template:
diff --git a/deploy/charts/litellm-helm/values.yaml b/deploy/charts/litellm-helm/values.yaml
index 0c00d2325a6..5324f6de762 100644
--- a/deploy/charts/litellm-helm/values.yaml
+++ b/deploy/charts/litellm-helm/values.yaml
@@ -201,6 +201,13 @@ migrationJob:
annotations: {}
ttlSecondsAfterFinished: 120
extraContainers: []
+
+ # Hook configuration
+ hooks:
+ argocd:
+ enabled: true
+ helm:
+ enabled: false
# Additional environment variables to be added to the deployment as a map of key-value pairs
envVars: {