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]

fix(helm): normalize ingress.extraPaths path types for ingress-nginx too

mateo-berriad0f0af1922e
diff --git a/helm/litellm/templates/ingress.yaml b/helm/litellm/templates/ingress.yaml
index 0a215de5a56..732564b280f 100644
--- a/helm/litellm/templates/ingress.yaml
+++ b/helm/litellm/templates/ingress.yaml
@@ -170,10 +170,11 @@ spec:
{{- if not $target }}
{{- fail (printf "ingress.extraPaths[%d] (path %s): unknown service %q, expected one of backend, gateway, ui" $idx $extra.path $service) }}
{{- end }}
- {{- $pathType := $extra.pathType | default "Prefix" }}
- {{- if not (has $pathType (list "Prefix" "Exact" "ImplementationSpecific")) }}
- {{- fail (printf "ingress.extraPaths[%d] (path %s): unknown pathType %q, expected one of Exact, ImplementationSpecific, Prefix" $idx $extra.path $pathType) }}
+ {{- $requestedPathType := $extra.pathType | default "Prefix" }}
+ {{- if not (has $requestedPathType (list "Prefix" "Exact" "ImplementationSpecific")) }}
+ {{- fail (printf "ingress.extraPaths[%d] (path %s): unknown pathType %q, expected one of Exact, ImplementationSpecific, Prefix" $idx $extra.path $requestedPathType) }}
{{- end }}
+ {{- $pathType := include "litellm.ingress.pathType" (dict "controller" $controller "path" $extra.path "pathType" $requestedPathType) }}
{{- if eq $extra.path "/" }}
{{- fail (printf "ingress.extraPaths[%d]: path / is already routed in both directions, Exact to ui and Prefix to backend, so no pathType leaves a request for an entry here to capture" $idx) }}
{{- end }}
diff --git a/helm/litellm/tests/ingress_controller_tests.yaml b/helm/litellm/tests/ingress_controller_tests.yaml
index a86271a02be..40790ba674a 100644
--- a/helm/litellm/tests/ingress_controller_tests.yaml
+++ b/helm/litellm/tests/ingress_controller_tests.yaml
@@ -127,3 +127,79 @@ tests:
asserts:
- failedTemplate:
errorMessage: 'ingress.controller: unknown controller "traefik", expected one of alb, nginx'
+
+ - it: rejects an extraPaths entry that repeats a built-in path once ingress-nginx normalizes its pathType
+ set:
+ ingress.enabled: true
+ ingress.controller: nginx
+ ingress.extraPaths:
+ - path: /favicon.ico
+ service: ui
+ asserts:
+ - failedTemplate:
+ errorMessage: "ingress.extraPaths[0]: path /favicon.ico with pathType ImplementationSpecific is already routed by this chart, and a duplicate would take it over rather than add to it"
+
+ - it: renders a dotted extraPaths entry as ImplementationSpecific for ingress-nginx
+ set:
+ ingress.enabled: true
+ ingress.controller: nginx
+ ingress.extraPaths:
+ - path: /eu.assemblyai.custom
+ service: gateway
+ - path: /robots.txt
+ service: ui
+ pathType: Exact
+ asserts:
+ - notMatchRegexRaw:
+ pattern: 'path: "?/\S*\.\S*"?\n\s+pathType: (Exact|Prefix)\n'
+ - contains:
+ path: spec.rules[0].http.paths
+ content:
+ path: /eu.assemblyai.custom
+ pathType: ImplementationSpecific
+ backend:
+ service:
+ name: RELEASE-NAME-litellm-gateway
+ port:
+ number: 4000
+ - contains:
+ path: spec.rules[0].http.paths
+ content:
+ path: /robots.txt
+ pathType: ImplementationSpecific
+ backend:
+ service:
+ name: RELEASE-NAME-litellm-ui
+ port:
+ number: 3000
+
+ - it: keeps the requested pathType of a dotted extraPaths entry for the AWS Load Balancer Controller
+ set:
+ ingress.enabled: true
+ ingress.extraPaths:
+ - path: /eu.assemblyai.custom
+ service: gateway
+ - path: /robots.txt
+ service: ui
+ pathType: Exact
+ asserts:
+ - contains:
+ path: spec.rules[0].http.paths
+ content:
+ path: /eu.assemblyai.custom
+ pathType: Prefix
+ backend:
+ service:
+ name: RELEASE-NAME-litellm-gateway
+ port:
+ number: 4000
+ - contains:
+ path: spec.rules[0].http.paths
+ content:
+ path: /robots.txt
+ pathType: Exact
+ backend:
+ service:
+ name: RELEASE-NAME-litellm-ui
+ port:
+ number: 3000
diff --git a/helm/litellm/values.yaml b/helm/litellm/values.yaml
index 592bb6d6131..461330ba491 100644
--- a/helm/litellm/values.yaml
+++ b/helm/litellm/values.yaml
@@ -11,7 +11,8 @@ ingress:
enabled: false
className: ""
# Which ingress controller serves this Ingress. Controllers disagree on the
- # pathTypes they accept, so this picks the pathType of a few built-in paths:
+ # pathTypes they accept, so this picks the pathType of the dotted paths, the
+ # built-in ones and any dotted extraPaths entry alike:
# alb AWS Load Balancer Controller (default): Exact and Prefix paths plus
# the /*.txt wildcard that routes the UI's RSC payloads.
# nginx ingress-nginx: its admission webhook rejects a dot in an Exact or
@@ -37,7 +38,8 @@ ingress:
#
# path required; the HTTP path to route
# service which component serves it: gateway (default), backend, or ui
- # pathType Prefix (default), Exact, or ImplementationSpecific
+ # pathType Prefix (default), Exact, or ImplementationSpecific; a dotted
+ # path renders as ImplementationSpecific when controller is nginx
#
# The target component only answers paths its own route allowlist keeps, so
# a path here still has to be one that component serves.