diff --git a/config/charts/inferencepool/README.md b/config/charts/inferencepool/README.md index bed4f33c2..388ac4016 100644 --- a/config/charts/inferencepool/README.md +++ b/config/charts/inferencepool/README.md @@ -24,7 +24,9 @@ Note that the provider name is needed to deploy provider-specific resources. If ### Install with Custom Environment Variables -To set custom environment variables for the EndpointPicker deployment: +#### Simple Environment Variables + +To set simple key-value environment variables for the EndpointPicker deployment: ```txt $ helm install vllm-llama3-8b-instruct \ @@ -43,6 +45,50 @@ inferenceExtension: FEATURE_FLAG_ENABLED: "true" ``` +#### Advanced Environment Variables + +For more complex environment variable configurations, including secrets, configmaps, and field references, use the `envVars` and `envFrom` fields: + +```yaml +# values.yaml +inferenceExtension: + # Simple key-value environment variables + env: + SIMPLE_VAR: "simple-value" + + # Advanced environment variables with valueFrom support + envVars: + - name: HF_TOKEN + valueFrom: + secretKeyRef: + name: hf-token + key: token + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: CONFIG_VALUE + valueFrom: + configMapKeyRef: + name: my-config + key: config-key + - name: MEMORY_LIMIT + valueFrom: + resourceFieldRef: + resource: limits.memory + + # Load all environment variables from secrets/configmaps + envFrom: + - secretRef: + name: my-secret + - configMapRef: + name: my-configmap +``` + And apply it with: ```txt @@ -84,7 +130,9 @@ The following table list the configurable parameters of the chart. | `inferenceExtension.image.tag` | Image tag of the endpoint picker. | | `inferenceExtension.image.pullPolicy` | Image pull policy for the container. Possible values: `Always`, `IfNotPresent`, or `Never`. Defaults to `Always`. | | `inferenceExtension.extProcPort` | Port where the endpoint picker service is served for external processing. Defaults to `9002`. | -| `inferenceExtension.env` | Map of environment variables to set in the endpoint picker container. Defaults to `{}`. | +| `inferenceExtension.env` | Map of simple key-value environment variables to set in the endpoint picker container. Defaults to `{}`. | +| `inferenceExtension.envVars` | List of advanced environment variables with valueFrom support (secretKeyRef, configMapKeyRef, fieldRef, resourceFieldRef). Defaults to `[]`. | +| `inferenceExtension.envFrom` | List of sources to populate environment variables from (secretRef, configMapRef). Defaults to `[]`. | | `provider.name` | Name of the Inference Gateway implementation being used. Possible values: `gke`. Defaults to `none`. | ## Notes diff --git a/config/charts/inferencepool/templates/epp-deployment.yaml b/config/charts/inferencepool/templates/epp-deployment.yaml index cdcd1da5f..4929a06b6 100644 --- a/config/charts/inferencepool/templates/epp-deployment.yaml +++ b/config/charts/inferencepool/templates/epp-deployment.yaml @@ -71,6 +71,64 @@ spec: - name: {{ $key }} value: {{ $value | quote }} {{- end }} + {{- if .Values.inferenceExtension.envVars }} + {{- range .Values.inferenceExtension.envVars }} + - name: {{ .name }} + {{- if .value }} + value: {{ .value | quote }} + {{- else if .valueFrom }} + valueFrom: + {{- if .valueFrom.secretKeyRef }} + secretKeyRef: + name: {{ .valueFrom.secretKeyRef.name }} + key: {{ .valueFrom.secretKeyRef.key }} + {{- if .valueFrom.secretKeyRef.optional }} + optional: {{ .valueFrom.secretKeyRef.optional }} + {{- end }} + {{- else if .valueFrom.configMapKeyRef }} + configMapKeyRef: + name: {{ .valueFrom.configMapKeyRef.name }} + key: {{ .valueFrom.configMapKeyRef.key }} + {{- if .valueFrom.configMapKeyRef.optional }} + optional: {{ .valueFrom.configMapKeyRef.optional }} + {{- end }} + {{- else if .valueFrom.fieldRef }} + fieldRef: + fieldPath: {{ .valueFrom.fieldRef.fieldPath }} + {{- if .valueFrom.fieldRef.apiVersion }} + apiVersion: {{ .valueFrom.fieldRef.apiVersion }} + {{- end }} + {{- else if .valueFrom.resourceFieldRef }} + resourceFieldRef: + resource: {{ .valueFrom.resourceFieldRef.resource }} + {{- if .valueFrom.resourceFieldRef.containerName }} + containerName: {{ .valueFrom.resourceFieldRef.containerName }} + {{- end }} + {{- if .valueFrom.resourceFieldRef.divisor }} + divisor: {{ .valueFrom.resourceFieldRef.divisor }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.inferenceExtension.envFrom }} + envFrom: + {{- range .Values.inferenceExtension.envFrom }} + {{- if .secretRef }} + - secretRef: + name: {{ .secretRef.name }} + {{- if .secretRef.optional }} + optional: {{ .secretRef.optional }} + {{- end }} + {{- else if .configMapRef }} + - configMapRef: + name: {{ .configMapRef.name }} + {{- if .configMapRef.optional }} + optional: {{ .configMapRef.optional }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} volumeMounts: - name: plugins-config-volume mountPath: "/config" diff --git a/config/charts/inferencepool/values.yaml b/config/charts/inferencepool/values.yaml index a070c4b81..cb6309ff7 100644 --- a/config/charts/inferencepool/values.yaml +++ b/config/charts/inferencepool/values.yaml @@ -28,10 +28,44 @@ inferenceExtension: # - pluginRef: max-score-picker # weight: 1 - # Example environment variables: + # Example environment variables (simple key-value pairs): # env: # KV_CACHE_SCORE_WEIGHT: "1" + # Example enhanced environment variables with valueFrom support: + # envVars: + # - name: HF_TOKEN + # valueFrom: + # secretKeyRef: + # name: hf-token + # key: token + # - name: POD_NAME + # valueFrom: + # fieldRef: + # fieldPath: metadata.name + # - name: POD_NAMESPACE + # valueFrom: + # fieldRef: + # fieldPath: metadata.namespace + # - name: CONFIG_VALUE + # valueFrom: + # configMapKeyRef: + # name: my-config + # key: config-key + # - name: MEMORY_LIMIT + # valueFrom: + # resourceFieldRef: + # resource: limits.memory + # - name: SIMPLE_VALUE + # value: "simple-string-value" + + # Example envFrom for loading all keys from secrets/configmaps: + # envFrom: + # - secretRef: + # name: my-secret + # - configMapRef: + # name: my-configmap + inferencePool: targetPortNumber: 8000 modelServerType: vllm # vllm, triton-tensorrt-llm