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): Add loadBalancerClass support for LoadBalancer services (#11064)
Gunjan Solankif1cc2d544eb0
diff --git a/deploy/charts/litellm-helm/Chart.yaml b/deploy/charts/litellm-helm/Chart.yamlindex 5de591fd730..bd63ca6bfca 100644--- a/deploy/charts/litellm-helm/Chart.yaml+++ b/deploy/charts/litellm-helm/Chart.yaml@@ -18,7 +18,7 @@ type: application# This is the chart version. This version number should be incremented each time you make changes# to the chart and its templates, including the app version.# Versions are expected to follow Semantic Versioning (https://semver.org/)-version: 0.4.3+version: 0.4.4# This is the version number of the application being deployed. This version number should be# incremented each time you make changes to the application. Versions are not expected todiff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.mdindex a0ba5781dfd..31bda3f7d79 100644--- a/deploy/charts/litellm-helm/README.md+++ b/deploy/charts/litellm-helm/README.md@@ -34,6 +34,7 @@ If `db.useStackgresOperator` is used (not yet implemented):| `serviceAccount.create` | Whether or not to create a Kubernetes Service Account for this deployment. The default is `false` because LiteLLM has no need to access the Kubernetes API. | `false` || `service.type` | Kubernetes Service type (e.g. `LoadBalancer`, `ClusterIP`, etc.) | `ClusterIP` || `service.port` | TCP port that the Kubernetes Service will listen on. Also the TCP port within the Pod that the proxy will listen on. | `4000` |+| `service.loadBalancerClass` | Optional LoadBalancer implementation class (only used when `service.type` is `LoadBalancer`) | `""` || `ingress.*` | See [values.yaml](./values.yaml) for example settings | N/A || `proxy_config.*` | See [values.yaml](./values.yaml) for default settings. See [example_config_yaml](../../../litellm/proxy/example_config_yaml/) for configuration examples. | N/A || `extraContainers[]` | An array of additional containers to be deployed as sidecars alongside the LiteLLM Proxy. | `[]` |diff --git a/deploy/charts/litellm-helm/templates/service.yaml b/deploy/charts/litellm-helm/templates/service.yamlindex d8d81e78c89..11812208929 100644--- a/deploy/charts/litellm-helm/templates/service.yaml+++ b/deploy/charts/litellm-helm/templates/service.yaml@@ -10,6 +10,9 @@ metadata:{{- include "litellm.labels" . | nindent 4 }}spec:type: {{ .Values.service.type }}+ {{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerClass }}+ loadBalancerClass: {{ .Values.service.loadBalancerClass }}+ {{- end }}ports:- port: {{ .Values.service.port }}targetPort: httpdiff --git a/deploy/charts/litellm-helm/tests/service_tests.yaml b/deploy/charts/litellm-helm/tests/service_tests.yamlnew file mode 100644index 00000000000..43ed0180bc8--- /dev/null+++ b/deploy/charts/litellm-helm/tests/service_tests.yaml@@ -0,0 +1,116 @@+suite: Service Configuration Tests+templates:+ - service.yaml+tests:+ - it: should create a default ClusterIP service+ template: service.yaml+ asserts:+ - isKind:+ of: Service+ - equal:+ path: spec.type+ value: ClusterIP+ - equal:+ path: spec.ports[0].port+ value: 4000+ - equal:+ path: spec.ports[0].targetPort+ value: http+ - equal:+ path: spec.ports[0].protocol+ value: TCP+ - equal:+ path: spec.ports[0].name+ value: http+ - isNull:+ path: spec.loadBalancerClass++ - it: should create a NodePort service when specified+ template: service.yaml+ set:+ service.type: NodePort+ asserts:+ - isKind:+ of: Service+ - equal:+ path: spec.type+ value: NodePort+ - isNull:+ path: spec.loadBalancerClass++ - it: should create a LoadBalancer service when specified+ template: service.yaml+ set:+ service.type: LoadBalancer+ asserts:+ - isKind:+ of: Service+ - equal:+ path: spec.type+ value: LoadBalancer+ - isNull:+ path: spec.loadBalancerClass++ - it: should add loadBalancerClass when specified with LoadBalancer type+ template: service.yaml+ set:+ service.type: LoadBalancer+ service.loadBalancerClass: tailscale+ asserts:+ - isKind:+ of: Service+ - equal:+ path: spec.type+ value: LoadBalancer+ - equal:+ path: spec.loadBalancerClass+ value: tailscale++ - it: should not add loadBalancerClass when specified with ClusterIP type+ template: service.yaml+ set:+ service.type: ClusterIP+ service.loadBalancerClass: tailscale+ asserts:+ - isKind:+ of: Service+ - equal:+ path: spec.type+ value: ClusterIP+ - isNull:+ path: spec.loadBalancerClass++ - it: should use custom port when specified+ template: service.yaml+ set:+ service.port: 8080+ asserts:+ - equal:+ path: spec.ports[0].port+ value: 8080++ - it: should add service annotations when specified+ template: service.yaml+ set:+ service.annotations:+ cloud.google.com/load-balancer-type: "Internal"+ service.beta.kubernetes.io/aws-load-balancer-internal: "true"+ asserts:+ - isKind:+ of: Service+ - equal:+ path: metadata.annotations+ value:+ cloud.google.com/load-balancer-type: "Internal"+ service.beta.kubernetes.io/aws-load-balancer-internal: "true"++ - it: should use the correct selector labels+ template: service.yaml+ asserts:+ - isNotNull:+ path: spec.selector+ - equal:+ path: spec.selector+ value:+ app.kubernetes.io/name: litellm+ app.kubernetes.io/instance: RELEASE-NAMEdiff --git a/deploy/charts/litellm-helm/values.yaml b/deploy/charts/litellm-helm/values.yamlindex 0440e28eed0..213db35a20f 100644--- a/deploy/charts/litellm-helm/values.yaml+++ b/deploy/charts/litellm-helm/values.yaml@@ -56,6 +56,9 @@ environmentConfigMaps: []service:type: ClusterIPport: 4000+ # If service type is `LoadBalancer` you can+ # optionally specify loadBalancerClass+ # loadBalancerClass: tailscaleingress:enabled: false