Skip to content

Commit

Permalink
[Feat] Add support for external Hugging Face token secrets in Helm ch…
Browse files Browse the repository at this point in the history
…art (#149)

* [Feat] Add support for external Hugging Face token secrets in Helm chart

- Update values.schema.json to allow HF token as a string or secret reference
- Modify values.yaml comments to clarify HF token configuration options
- Update deployment and secrets templates to handle both token types
- Fix a minor comment in PVC template about default storage size

* [Fix] Correct Helm chart secret reference in vLLM multi-model deployment

Signed-off-by: Liad Drori <[email protected]>
  • Loading branch information
liaddrori1 authored Feb 25, 2025
1 parent c10a2c2 commit 0143de5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
7 changes: 7 additions & 0 deletions helm/templates/deployment-vllm-multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@ spec:
{{- end}}
{{- if $modelSpec.hf_token }}
- name: HF_TOKEN
{{- if kindIs "string" $modelSpec.hf_token }}
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-secrets
key: hf_token_{{ $modelSpec.name }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ $modelSpec.hf_token.secretName }}
key: {{ $modelSpec.hf_token.secretKey }}
{{- end }}
{{- end }}
{{- with $modelSpec.env }}
{{- toYaml . | nindent 10 }}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
{{- end }}
resources:
requests:
storage: {{ $modelSpec.pvcStorage | default "20Gi" }} # Default to 40Gi if not set
storage: {{ $modelSpec.pvcStorage | default "20Gi" }} # Default to 20Gi if not set
{{- if hasKey $modelSpec "storageClass" }}
storageClassName: "{{ $modelSpec.storageClass }}"
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type: Opaque
data:
{{- range $modelSpec := .Values.servingEngineSpec.modelSpec }}
{{- with $ -}}
{{- if $modelSpec.hf_token }}
{{- if and $modelSpec.hf_token (kindIs "string" $modelSpec.hf_token) }}
hf_token_{{ $modelSpec.name }}: {{ $modelSpec.hf_token | b64enc | quote }}
{{- end }}
{{- end }}
Expand Down
12 changes: 11 additions & 1 deletion helm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@
"required": ["enabled", "cpuOffloadingBufferSize"]
},
"hf_token": {
"type": "string"
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"secretName": { "type": "string" },
"secretKey": { "type": "string" }
},
"required": ["secretName", "secretKey"]
}
]
},
"env": {
"type": "array",
Expand Down
8 changes: 6 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ servingEngineSpec:
# - enabled: (optional, bool) Enable LMCache, e.g., true
# - cpuOffloadingBufferSize: (optional, string) The CPU offloading buffer size, e.g., "30"
#
# - hf_token: (optional, string) the Huggingface tokens for this model
# - hf_token: (optional) Hugging Face token configuration. Can be either:
# - A string containing the token directly (will be stored in a generated secret)
# - An object referencing an existing secret:
# secretName: "my-existing-secret"
# secretKey: "hf-token-key"
#
# - env: (optional, list) The environment variables to set in the container, e.g., your HF_TOKEN
#
Expand Down Expand Up @@ -75,7 +79,7 @@ servingEngineSpec:
# enabled: true
# cpuOffloadingBufferSize: "30"
#
# hf_token: <HUGGING_FACE_TOKEN>
# hf_token: "hf_xxxxxxxxxxxxx"
#
# nodeSelectorTerms:
# - matchExpressions:
Expand Down

0 comments on commit 0143de5

Please sign in to comment.