mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
Render a general_settings.coordination_redis block into the litellm-helm proxy config when the bundled Redis is enabled, gated on a new redis.coordination.enabled value and skipped when the user already supplies their own block. Sentinel deployments render sentinel_nodes and service_name rather than a host/port pair. Also fixes litellm.redis.serviceName, which gated its sentinel branch on standalone architecture. The bundled Redis subchart only serves sentinel in replication mode, and renders no master Service there, so REDIS_HOST pointed at a Service that never existed for every sentinel user. Documents the coordination redis in the componentized chart and in the terraform modules, whose existing REDIS_* exports now feed it directly. Adds helm-unittest coverage for both charts' redis wiring, which had none
101 lines
3.2 KiB
Smarty
101 lines
3.2 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 }}
|
|
|
|
{{/*
|
|
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 -}}
|