diff --git a/helm/README.md b/helm/README.md index 2f865f56b..6270a71ae 100644 --- a/helm/README.md +++ b/helm/README.md @@ -339,6 +339,7 @@ Set `servingEngineSpec.modelSpec[].raySpec.enabled: true` to deploy the model as | `cacheserverSpec.serviceType` | string | `"ClusterIP"` | Kubernetes service type for the cache server | | `cacheserverSpec.servicePort` | integer | `80` | Port the cache server service will listen on | | `cacheserverSpec.resources` | map | `{}` | Resource requests and limits | +| `cacheserverSpec.env` | list | `[]` | Extra environment variables for the cache server container, e.g. to configure LMCache's eviction policy via `LMCACHE_CACHE_POLICY` and `LMCACHE_MAX_LOCAL_CPU_SIZE` | | `cacheserverSpec.labels` | map | `{environment: "cache", release: "cache"}` | Customized labels for the cache server deployment | | `cacheserverSpec.strategy` | map | `{}` | Deployment strategy for the cache server pods | | `cacheserverSpec.livenessProbe` | map | `{initialDelaySeconds: 15, periodSeconds: 10, failureThreshold: 3, httpGet: {path: /health, port: 8000}}` | Configuration for the liveness probe | diff --git a/helm/templates/deployment-cache-server.yaml b/helm/templates/deployment-cache-server.yaml index cbbe613d7..ca5c46d3e 100644 --- a/helm/templates/deployment-cache-server.yaml +++ b/helm/templates/deployment-cache-server.yaml @@ -63,6 +63,10 @@ spec: - "/opt/venv/bin/lmcache_server" - "0.0.0.0" - "{{ .Values.cacheserverSpec.containerPort }}" + {{- with .Values.cacheserverSpec.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.cacheserverSpec.resources }} resources: {{- toYaml . | nindent 12 }} diff --git a/helm/tests/cacheserver_test.yaml b/helm/tests/cacheserver_test.yaml index 828124b2b..cdd207396 100644 --- a/helm/tests/cacheserver_test.yaml +++ b/helm/tests/cacheserver_test.yaml @@ -36,6 +36,11 @@ tests: requests: cpu: "0.5" memory: "512Mi" + env: + - name: LMCACHE_CACHE_POLICY + value: "LRU" + - name: LMCACHE_MAX_LOCAL_CPU_SIZE + value: "16" annotations: annotation-key: annotation-value labels: @@ -165,6 +170,14 @@ tests: path: spec.template.spec.containers[0].imagePullPolicy value: "Always" + - equal: + path: spec.template.spec.containers[0].env + value: + - name: LMCACHE_CACHE_POLICY + value: "LRU" + - name: LMCACHE_MAX_LOCAL_CPU_SIZE + value: "16" + - equal: path: spec.template.spec.containers[0].livenessProbe value: diff --git a/helm/values.schema.json b/helm/values.schema.json index bae9926ef..a01abeec7 100644 --- a/helm/values.schema.json +++ b/helm/values.schema.json @@ -26,6 +26,10 @@ "description": "Whether to enable the cache server", "type": "boolean" }, + "env": { + "description": "Extra environment variables for the cache server container, e.g. to configure LMCache's eviction policy via `LMCACHE_CACHE_POLICY` and `LMCACHE_MAX_LOCAL_CPU_SIZE` (https://docs.lmcache.ai/api_reference/configurations.html)", + "type": "array" + }, "image": { "description": "Image configuration for the cache Server", "type": "object", diff --git a/helm/values.yaml b/helm/values.yaml index 728cc372a..2f6e6762b 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -814,6 +814,10 @@ cacheserverSpec: serviceAnnotations: {} # -- Resource requests and limits for the cache server container resources: {} + # -- Extra environment variables for the cache server container, e.g. to + # configure LMCache's eviction policy via `LMCACHE_CACHE_POLICY` and + # `LMCACHE_MAX_LOCAL_CPU_SIZE` (https://docs.lmcache.ai/api_reference/configurations.html) + env: [] # -- Customized annotations for the cache server deployment annotations: {} # -- Customized labels for the cache server deployment and service