You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2026/09/08 04:14:04 UTC
(answer) branch dev updated: charts: support using an existing PVC via persistence.existingClaim
This is an automated email from the ASF dual-hosted git repository.
LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/dev by this push:
new f4db9ec5 charts: support using an existing PVC via persistence.existingClaim
f4db9ec5 is described below
commit f4db9ec5275b3b2b3d925e35c7c6ce4966722483
Author: Steven Koo <st...@emerson.com>
AuthorDate: Tue Sep 1 16:07:16 2026 -0500
charts: support using an existing PVC via persistence.existingClaim
Add a new `persistence.existingClaim` value that, when set, causes the
deployment to mount the specified PVC instead of the chart-managed one
and skips creation of the PVC resource entirely.
Signed-off-by: Steven Koo <st...@emerson.com>
---
charts/templates/deployment.yaml | 2 +-
charts/templates/pvc.yaml | 2 +-
charts/values.yaml | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml
index f1b9d186..57d57ac2 100644
--- a/charts/templates/deployment.yaml
+++ b/charts/templates/deployment.yaml
@@ -101,7 +101,7 @@ spec:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
- claimName: {{ include "answer.fullname" . }}-claim
+ claimName: {{ .Values.persistence.existingClaim | default (printf "%s-claim" (include "answer.fullname" .)) }}
{{- else }}
emptyDir: {}
{{- end -}}
diff --git a/charts/templates/pvc.yaml b/charts/templates/pvc.yaml
index 640fb9fe..e01ff820 100644
--- a/charts/templates/pvc.yaml
+++ b/charts/templates/pvc.yaml
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-{{ if .Values.persistence.enabled -}}
+{{ if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
diff --git a/charts/values.yaml b/charts/values.yaml
index d932db84..7a5c16f3 100644
--- a/charts/values.yaml
+++ b/charts/values.yaml
@@ -91,6 +91,8 @@ persistence:
accessMode: ReadWriteOnce
size: 5Gi
annotations: {}
+ # Use an existing PVC instead of creating one; when set, no PVC is created by this chart
+ existingClaim: ""
# To restore a PVC from a VolumeSnapshot, set the dataSource;
# the kind and apiGroup are optional and default to the shown values
dataSource: {}