mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
Bitnami retired the versioned tags under docker.io/bitnami and republished the archived builds under docker.io/bitnamilegacy, so every install and upgrade of the chart with the bundled database fails to pull docker.io/bitnami/postgresql:16.2.0-debian-12-r6. Repoint the subchart images at the bitnamilegacy copies of the exact builds those subchart versions shipped with, so the on-disk data directory layout is unchanged for existing installs. Pin the subchart dependency ranges to the versions already in Chart.lock. The current bitnami postgresql chart defaults to `tag: latest`, which is PostgreSQL 18 today, so an open-ended range turns a dependency refresh into a major-version jump on an existing volume. Refuse to render when postgresql.image.tag is empty or `latest` while the bundled database is deployed. Starting a different PostgreSQL major against an existing data directory leaves the server unable to boot with no in-place way back, which is how the reported install lost its data. Resolves LIT-4708
163 lines
6.1 KiB
Smarty
163 lines
6.1 KiB
Smarty
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "litellm.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create a default fully qualified app name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
If release name contains chart name it will be used as a full name.
|
|
*/}}
|
|
{{- define "litellm.fullname" -}}
|
|
{{- if .Values.fullnameOverride }}
|
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- else }}
|
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
|
{{- if contains $name .Release.Name }}
|
|
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
|
{{- else }}
|
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create chart name and version as used by the chart label.
|
|
*/}}
|
|
{{- define "litellm.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Common labels
|
|
*/}}
|
|
{{- define "litellm.labels" -}}
|
|
helm.sh/chart: {{ include "litellm.chart" . }}
|
|
{{ include "litellm.selectorLabels" . }}
|
|
{{- if .Chart.AppVersion }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
{{- end }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Selector labels
|
|
*/}}
|
|
{{- define "litellm.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "litellm.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Enterprise billable-request metering. The client certificate identifies the
|
|
deployment to LiteLLM's collector, so it is mounted read-only from an existing
|
|
Secret rather than passed through the environment.
|
|
*/}}
|
|
{{- define "litellm.billingMetrics.certDir" -}}/etc/litellm/billing-mtls{{- end -}}
|
|
{{- define "litellm.billingMetrics.caDir" -}}/etc/litellm/billing-mtls-ca{{- end -}}
|
|
|
|
{{- define "litellm.billingMetricsEnv" -}}
|
|
- name: LITELLM_BILLING_METRICS_ENDPOINT
|
|
value: {{ required "billingMetrics.endpoint is required when billingMetrics.enabled is true" .Values.billingMetrics.endpoint | quote }}
|
|
- name: LITELLM_BILLING_METRICS_CLIENT_CERT
|
|
value: {{ printf "%s/tls.crt" (include "litellm.billingMetrics.certDir" .) | quote }}
|
|
- name: LITELLM_BILLING_METRICS_CLIENT_KEY
|
|
value: {{ printf "%s/tls.key" (include "litellm.billingMetrics.certDir" .) | quote }}
|
|
{{- if .Values.billingMetrics.caSecretName }}
|
|
- name: LITELLM_BILLING_METRICS_CA_CERT
|
|
value: {{ printf "%s/ca.crt" (include "litellm.billingMetrics.caDir" .) | quote }}
|
|
{{- end }}
|
|
{{- with .Values.billingMetrics.exportIntervalMs }}
|
|
- name: LITELLM_BILLING_METRICS_EXPORT_INTERVAL_MS
|
|
value: {{ . | quote }}
|
|
{{- end }}
|
|
{{- end -}}
|
|
|
|
{{- define "litellm.billingMetricsVolumes" -}}
|
|
- name: billing-metrics-mtls
|
|
secret:
|
|
secretName: {{ required "billingMetrics.secretName is required when billingMetrics.enabled is true (an existing Secret with tls.crt and tls.key)" .Values.billingMetrics.secretName }}
|
|
{{- if .Values.billingMetrics.caSecretName }}
|
|
- name: billing-metrics-mtls-ca
|
|
secret:
|
|
secretName: {{ .Values.billingMetrics.caSecretName }}
|
|
{{- end }}
|
|
{{- end -}}
|
|
|
|
{{- define "litellm.billingMetricsVolumeMounts" -}}
|
|
- name: billing-metrics-mtls
|
|
mountPath: {{ include "litellm.billingMetrics.certDir" . }}
|
|
readOnly: true
|
|
{{- if .Values.billingMetrics.caSecretName }}
|
|
- name: billing-metrics-mtls-ca
|
|
mountPath: {{ include "litellm.billingMetrics.caDir" . }}
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create the name of the service account to use
|
|
*/}}
|
|
{{- define "litellm.serviceAccountName" -}}
|
|
{{- if .Values.serviceAccount.create }}
|
|
{{- default (include "litellm.fullname" .) .Values.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the service account name used by migration jobs.
|
|
When Helm hooks are enabled, pre-install/pre-upgrade hooks run before normal resources.
|
|
If this chart is creating the ServiceAccount, it is not yet available for the hook job,
|
|
so fall back to "default" (or an explicit override) to avoid a cyclic dependency.
|
|
*/}}
|
|
{{- define "litellm.migrationServiceAccountName" -}}
|
|
{{- if and .Values.migrationJob.hooks.helm.enabled .Values.serviceAccount.create }}
|
|
{{- default "default" .Values.migrationJob.serviceAccountName }}
|
|
{{- else }}
|
|
{{- include "litellm.serviceAccountName" . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Get redis service name.
|
|
The bundled Redis subchart only serves sentinel in "replication" architecture
|
|
(it rejects standalone + sentinel outright), and in that mode the sentinel
|
|
Service is named "<release>-redis", not "<release>-redis-master".
|
|
*/}}
|
|
{{- define "litellm.redis.serviceName" -}}
|
|
{{- if .Values.redis.sentinel.enabled -}}
|
|
{{- printf "%s-%s" .Release.Name (default "redis" .Values.redis.nameOverride | trunc 63 | trimSuffix "-") -}}
|
|
{{- else -}}
|
|
{{- printf "%s-%s-master" .Release.Name (default "redis" .Values.redis.nameOverride | trunc 63 | trimSuffix "-") -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Get redis service port
|
|
*/}}
|
|
{{- define "litellm.redis.port" -}}
|
|
{{- if .Values.redis.sentinel.enabled -}}
|
|
{{ .Values.redis.sentinel.service.ports.sentinel }}
|
|
{{- else -}}
|
|
{{ .Values.redis.master.service.ports.redis }}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Reject an unpinned image tag for the bundled PostgreSQL.
|
|
A floating tag lets a chart upgrade start a newer PostgreSQL major against the
|
|
existing PersistentVolumeClaim. The server then refuses to start on a data
|
|
directory written by another major version, and the only way back is a dump
|
|
taken before the change, which by that point no longer exists.
|
|
*/}}
|
|
{{- define "litellm.validateBundledPostgresImageTag" -}}
|
|
{{- $tag := .Values.postgresql.image.tag | default "" | toString -}}
|
|
{{- $digest := .Values.postgresql.image.digest | default "" | toString -}}
|
|
{{- if and (eq $digest "") (or (eq $tag "") (eq $tag "latest")) -}}
|
|
{{- fail (printf "postgresql.image.tag must be pinned to an explicit version when db.deployStandalone is true (got %q). An unpinned tag can start a different PostgreSQL major against the existing data directory, which makes the database unreadable and is not recoverable in place. Crossing a major version requires a dump and restore." $tag) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|