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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
feat(helm): split per-component ServiceAccounts for gateway, backend, and UI (#28712)
Yassin Kortam47c92669c298
diff --git a/helm/litellm/templates/_helpers.tpl b/helm/litellm/templates/_helpers.tplindex e2faf42b766..4319907883e 100644--- a/helm/litellm/templates/_helpers.tpl+++ b/helm/litellm/templates/_helpers.tpl@@ -56,16 +56,34 @@ app.kubernetes.io/component: ui{{- end -}}{{/*-Shared ServiceAccount name used by all three component Deployments. When-`serviceAccount.create` is true and `serviceAccount.name` is empty, default-to the chart fullname. When `create` is false, fall back to the provided-name or the namespace's `default` SA.+Per-component ServiceAccount name helpers.++Each component (gateway, backend, ui) has its own SA config under+.Values.serviceAccounts.<component>. When `create` is true and `name` is+empty the chart defaults to "<release>-litellm-<component>". When `create`+is false the chart uses the provided name, or the namespace `default` SA.*/}}-{{- define "litellm.serviceAccountName" -}}-{{- if .Values.serviceAccount.create -}}-{{ default (include "litellm.fullname" .) .Values.serviceAccount.name }}+{{- define "litellm.gateway.serviceAccountName" -}}+{{- if .Values.serviceAccounts.gateway.create -}}+{{ default (include "litellm.gateway.fullname" .) .Values.serviceAccounts.gateway.name }}+{{- else -}}+{{ default "default" .Values.serviceAccounts.gateway.name }}+{{- end -}}+{{- end -}}++{{- define "litellm.backend.serviceAccountName" -}}+{{- if .Values.serviceAccounts.backend.create -}}+{{ default (include "litellm.backend.fullname" .) .Values.serviceAccounts.backend.name }}+{{- else -}}+{{ default "default" .Values.serviceAccounts.backend.name }}+{{- end -}}+{{- end -}}++{{- define "litellm.ui.serviceAccountName" -}}+{{- if .Values.serviceAccounts.ui.create -}}+{{ default (include "litellm.ui.fullname" .) .Values.serviceAccounts.ui.name }}{{- else -}}-{{ default "default" .Values.serviceAccount.name }}+{{ default "default" .Values.serviceAccounts.ui.name }}{{- end -}}{{- end -}}diff --git a/helm/litellm/templates/backend/deployment.yaml b/helm/litellm/templates/backend/deployment.yamlindex e761409f8c4..3b59c58c8bf 100644--- a/helm/litellm/templates/backend/deployment.yaml+++ b/helm/litellm/templates/backend/deployment.yaml@@ -19,7 +19,8 @@ spec:labels:{{- include "litellm.backend.selectorLabels" . | nindent 8 }}spec:- serviceAccountName: {{ include "litellm.serviceAccountName" . }}+ serviceAccountName: {{ include "litellm.backend.serviceAccountName" . }}+ automountServiceAccountToken: {{ .Values.serviceAccounts.backend.automount }}{{- with .Values.imagePullSecrets }}imagePullSecrets:{{- toYaml . | nindent 8 }}diff --git a/helm/litellm/templates/gateway/deployment.yaml b/helm/litellm/templates/gateway/deployment.yamlindex 935d432342e..05ea4052159 100644--- a/helm/litellm/templates/gateway/deployment.yaml+++ b/helm/litellm/templates/gateway/deployment.yaml@@ -22,7 +22,8 @@ spec:labels:{{- include "litellm.gateway.selectorLabels" . | nindent 8 }}spec:- serviceAccountName: {{ include "litellm.serviceAccountName" . }}+ serviceAccountName: {{ include "litellm.gateway.serviceAccountName" . }}+ automountServiceAccountToken: {{ .Values.serviceAccounts.gateway.automount }}{{- with .Values.imagePullSecrets }}imagePullSecrets:{{- toYaml . | nindent 8 }}diff --git a/helm/litellm/templates/migrations-job.yaml b/helm/litellm/templates/migrations-job.yamlindex f3dc2ae0236..92671388546 100644--- a/helm/litellm/templates/migrations-job.yaml+++ b/helm/litellm/templates/migrations-job.yaml@@ -28,7 +28,7 @@ spec:app.kubernetes.io/component: migrationsspec:restartPolicy: Never- serviceAccountName: {{ include "litellm.serviceAccountName" . }}+ serviceAccountName: {{ include "litellm.backend.serviceAccountName" . }}{{- with .Values.imagePullSecrets }}imagePullSecrets:{{- toYaml . | nindent 8 }}diff --git a/helm/litellm/templates/serviceaccount.yaml b/helm/litellm/templates/serviceaccount.yamlindex 3c998448ae5..a2fc52f47c0 100644--- a/helm/litellm/templates/serviceaccount.yaml+++ b/helm/litellm/templates/serviceaccount.yaml@@ -1,13 +1,51 @@-{{- if .Values.serviceAccount.create -}}+{{- $prev := false -}}+{{- if .Values.serviceAccounts.gateway.create -}}+{{- $prev = true }}apiVersion: v1kind: ServiceAccountmetadata:- name: {{ include "litellm.serviceAccountName" . }}+ name: {{ include "litellm.gateway.serviceAccountName" . }}labels:{{- include "litellm.commonLabels" . | nindent 4 }}- {{- with .Values.serviceAccount.annotations }}+ app.kubernetes.io/component: gateway+ {{- with .Values.serviceAccounts.gateway.annotations }}annotations:{{- toYaml . | nindent 4 }}{{- end }}-automountServiceAccountToken: {{ .Values.serviceAccount.automount }}+automountServiceAccountToken: {{ .Values.serviceAccounts.gateway.automount }}+{{- end }}+{{- if .Values.serviceAccounts.backend.create }}+{{- if $prev }}+---+{{- end }}+{{- $prev = true }}+apiVersion: v1+kind: ServiceAccount+metadata:+ name: {{ include "litellm.backend.serviceAccountName" . }}+ labels:+ {{- include "litellm.commonLabels" . | nindent 4 }}+ app.kubernetes.io/component: backend+ {{- with .Values.serviceAccounts.backend.annotations }}+ annotations:+ {{- toYaml . | nindent 4 }}+ {{- end }}+automountServiceAccountToken: {{ .Values.serviceAccounts.backend.automount }}+{{- end }}+{{- if .Values.serviceAccounts.ui.create }}+{{- if $prev }}+---+{{- end }}+apiVersion: v1+kind: ServiceAccount+metadata:+ name: {{ include "litellm.ui.serviceAccountName" . }}+ labels:+ {{- include "litellm.commonLabels" . | nindent 4 }}+ app.kubernetes.io/component: ui+ {{- with .Values.serviceAccounts.ui.annotations }}+ annotations:+ {{- toYaml . | nindent 4 }}+ {{- end }}+automountServiceAccountToken: {{ .Values.serviceAccounts.ui.automount }}{{- end }}diff --git a/helm/litellm/templates/ui/deployment.yaml b/helm/litellm/templates/ui/deployment.yamlindex 549bf61a0dd..b40b44cca53 100644--- a/helm/litellm/templates/ui/deployment.yaml+++ b/helm/litellm/templates/ui/deployment.yaml@@ -19,7 +19,8 @@ spec:labels:{{- include "litellm.ui.selectorLabels" . | nindent 8 }}spec:- serviceAccountName: {{ include "litellm.serviceAccountName" . }}+ serviceAccountName: {{ include "litellm.ui.serviceAccountName" . }}+ automountServiceAccountToken: {{ .Values.serviceAccounts.ui.automount }}{{- with .Values.imagePullSecrets }}imagePullSecrets:{{- toYaml . | nindent 8 }}diff --git a/helm/litellm/values.yaml b/helm/litellm/values.yamlindex 92477616a9a..934661643bd 100644--- a/helm/litellm/values.yaml+++ b/helm/litellm/values.yaml@@ -14,16 +14,33 @@ ingress:host: "" # optional; if set, becomes the rule's hosttls: []-# Shared ServiceAccount used by all three component Deployments. Set-# `create: true` to have the chart provision it (e.g. when wiring an EKS-# Pod Identity association by SA name). Set `name` to use an existing SA-# (chart-created or out-of-band). When both are empty / false, pods run-# with the namespace's `default` SA.-serviceAccount:- create: false- automount: true- annotations: {}- name: ""+# Per-component ServiceAccounts for gateway, backend, and ui.+#+# Each section mirrors the old shared serviceAccount shape. Set `create:+# true` to have the chart provision the SA (useful for EKS Pod Identity /+# GKE Workload Identity annotations). Set `name` to bind an existing SA.+# When both are unset the component pod runs with the namespace `default` SA.+#+# The UI SA deliberately defaults to `automount: false` — the static nginx+# container does not need the K8s API and should not carry a projected+# ServiceAccount token that a compromised container could use to call the+# cloud-provider metadata service or the K8s API.+serviceAccounts:+ gateway:+ create: false+ automount: true+ annotations: {}+ name: ""+ backend:+ create: false+ automount: true+ annotations: {}+ name: ""+ ui:+ create: false+ automount: false+ annotations: {}+ name: ""# Pre-install / pre-upgrade Helm hook that runs `prisma migrate deploy`# against the writer database, creating the LiteLLM schema (tables that