mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-23 18:25:22 +00:00
feat(helm): Add loadBalancerClass support for LoadBalancer services (#11064)
* feat(helm): Add loadBalancerClass support for LoadBalancer services Adds the ability to specify a loadBalancerClass when using LoadBalancer service type. This enables integration with custom load balancer implementations like Tailscale. * fixup! feat(helm): Add loadBalancerClass support for LoadBalancer services
This commit is contained in:
@@ -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 to
|
||||
|
||||
@@ -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. | `[]` |
|
||||
|
||||
@@ -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: http
|
||||
|
||||
@@ -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-NAME
|
||||
@@ -56,6 +56,9 @@ environmentConfigMaps: []
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 4000
|
||||
# If service type is `LoadBalancer` you can
|
||||
# optionally specify loadBalancerClass
|
||||
# loadBalancerClass: tailscale
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
|
||||
Reference in New Issue
Block a user