diff --git a/helm/templates/deployment-vllm-multi.yaml b/helm/templates/deployment-vllm-multi.yaml index 52d5ea902..7b57d6a33 100644 --- a/helm/templates/deployment-vllm-multi.yaml +++ b/helm/templates/deployment-vllm-multi.yaml @@ -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 }} {{- end }} {{- end }} {{- if $.Values.sharedPvcStorage.enabled }} diff --git a/helm/templates/pvc.yaml b/helm/templates/pvc.yaml index a23e83541..6ddfa10de 100644 --- a/helm/templates/pvc.yaml +++ b/helm/templates/pvc.yaml @@ -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) }} apiVersion: v1 kind: PersistentVolumeClaim metadata: diff --git a/helm/tests/pvc_test.yaml b/helm/tests/pvc_test.yaml index 6e068436e..76deb7737 100644 --- a/helm/tests/pvc_test.yaml +++ b/helm/tests/pvc_test.yaml @@ -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 diff --git a/helm/values.yaml b/helm/values.yaml index 3cc8a3125..0faa65e35 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -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" # -- Additional volumes to add to the pod, in Kubernetes volume format extraVolumes: [] # - name: tmp-volume