Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm/templates/deployment-vllm-multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ spec:
{{- toYaml $modelSpec.pvcStorage.emptyDir | nindent 12 }}
{{- else if kindIs "string" $modelSpec.pvcStorage }}
persistentVolumeClaim:
claimName: "{{ .Release.Name }}-{{$modelSpec.name}}-storage-claim"
claimName: {{ $modelSpec.pvcExistingClaimName | default (printf "%s-%s-storage-claim" .Release.Name $modelSpec.name) | quote }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The persistentVolumeClaim block is nested inside {{- else if kindIs "string" $modelSpec.pvcStorage }} (line 472). This means that if a user sets pvcExistingClaimName but unsets pvcStorage or sets it to a non-string value, the persistentVolumeClaim volume will not be rendered at all.

To make this more robust and avoid silent failures when pvcStorage is omitted, consider updating the outer template guards (such as lines 418, 464, and 472) to also check for pvcExistingClaimName (e.g., or (hasKey $modelSpec "pvcStorage") (hasKey $modelSpec "pvcExistingClaimName")).

{{- end }}
{{- end }}
{{- if $.Values.sharedPvcStorage.enabled }}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- if .Values.servingEngineSpec.enableEngine -}}
{{- range $modelSpec := .Values.servingEngineSpec.modelSpec }}
{{- with $ -}}
{{- if and (hasKey $modelSpec "pvcStorage") (not (empty $modelSpec.pvcStorage)) (kindIs "string" $modelSpec.pvcStorage) }}
{{- if and (hasKey $modelSpec "pvcStorage") (not (empty $modelSpec.pvcStorage)) (kindIs "string" $modelSpec.pvcStorage) (empty $modelSpec.pvcExistingClaimName) }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Skipping PVC rendering when pvcExistingClaimName is set will result in empty YAML documents (consecutive --- separators) because the --- separator at line 39 is rendered for every model in the loop, regardless of whether the PVC itself is rendered.

To prevent generating empty documents or trailing/consecutive --- separators, the --- separator should be moved inside the if block (e.g., at the very beginning of the if block, before apiVersion: v1), and the hardcoded --- at line 39 should be removed.

{{- if and (hasKey $modelSpec "pvcStorage") (not (empty $modelSpec.pvcStorage)) (kindIs "string" $modelSpec.pvcStorage) (empty $modelSpec.pvcExistingClaimName) -}}
---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down
13 changes: 13 additions & 0 deletions helm/tests/pvc_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,16 @@ tests:
path: spec.selector.matchLabels
value:
model: "mistral"

- it: should not render a PVC when an existing claim is provided
set:
servingEngineSpec:
enableEngine: true
modelSpec:
- name: "test-model"
pvcStorage: "50Gi"
pvcExistingClaimName: "my-existing-claim"
asserts:
- template: pvc.yaml
hasDocuments:
count: 0
5 changes: 5 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ servingEngineSpec:
pvcLabels: {}
# -- The annotations to add to the PVC
pvcAnnotations: {}
# Use an externally-managed PersistentVolumeClaim instead of one created by
# this chart. When set, the chart skips rendering the PVC and mounts the
# named claim directly (useful for GitOps setups where PVCs are managed
# outside the chart). Leave unset to have the chart create the PVC.
# pvcExistingClaimName: "my-existing-claim"
Comment on lines +97 to +101

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When pvcExistingClaimName is used, the chart's deployment template still requires pvcStorage to be set to a valid string (e.g., "50Gi") to trigger the creation of the volume and volume mounts. If a user unsets pvcStorage or sets it to null (which is a common expectation when using an existing PVC), the volume will not be mounted at all.

Please document this requirement in the comments so users are aware they must keep pvcStorage defined.

    # Use an externally-managed PersistentVolumeClaim instead of one created by
    # this chart. When set, the chart skips rendering the PVC and mounts the
    # named claim directly (useful for GitOps setups where PVCs are managed
    # outside the chart). Leave unset to have the chart create the PVC.
    # Note: pvcStorage must still be set to a valid string (e.g., "50Gi") to trigger
    # the volume and volumeMounts creation in the deployment.
    # pvcExistingClaimName: "my-existing-claim"

# -- Additional volumes to add to the pod, in Kubernetes volume format
extraVolumes: []
# - name: tmp-volume
Expand Down
Loading