-
Notifications
You must be signed in to change notification settings - Fork 428
feat(helm): support externally-managed PVC via pvcExistingClaimName (#938) #988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skipping PVC rendering when To prevent generating empty documents or trailing/consecutive {{- if and (hasKey $modelSpec "pvcStorage") (not (empty $modelSpec.pvcStorage)) (kindIs "string" $modelSpec.pvcStorage) (empty $modelSpec.pvcExistingClaimName) -}}
--- |
||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When Please document this requirement in the comments so users are aware they must keep # 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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
persistentVolumeClaimblock is nested inside{{- else if kindIs "string" $modelSpec.pvcStorage }}(line 472). This means that if a user setspvcExistingClaimNamebut unsetspvcStorageor sets it to a non-string value, thepersistentVolumeClaimvolume will not be rendered at all.To make this more robust and avoid silent failures when
pvcStorageis omitted, consider updating the outer template guards (such as lines 418, 464, and 472) to also check forpvcExistingClaimName(e.g.,or (hasKey $modelSpec "pvcStorage") (hasKey $modelSpec "pvcExistingClaimName")).