From 4679f3cf419c8ee0040933ed009b04a01fb8bd43 Mon Sep 17 00:00:00 2001 From: maddin Date: Wed, 5 Aug 2026 11:03:57 +0200 Subject: [PATCH] Helm Chart: Add existingClaim to persistence --- pkg/helm/README.md | 1 + pkg/helm/templates/deployment.yaml | 2 +- pkg/helm/templates/pvc.yaml | 4 ++-- pkg/helm/values.yaml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/helm/README.md b/pkg/helm/README.md index a719ecf78a1..7120effbcad 100644 --- a/pkg/helm/README.md +++ b/pkg/helm/README.md @@ -35,6 +35,7 @@ The chart should dump its version and appVersion in the Chart.yaml file every re | `preferences.data` | Preferences to load | `{}` | | `resources.*` | Allocated requests and limits resources | `{"requests": {...}, "limits": {...}}` | | `persistence.enabled` | PVC resource creation | `true` | +| `persistence.existingClaim` | Provide existing PVC instead of creating one | `""` | | `service.type` | Service type | `"ClusterIP"` | | `service.loadBalancerIP` | Load balancer IP (Only if service.type is LoadBalancer) | `""` | | `ingress.enabled` | Ingress resource creation | `false` | diff --git a/pkg/helm/templates/deployment.yaml b/pkg/helm/templates/deployment.yaml index b2c6c4620c3..5c12294868b 100644 --- a/pkg/helm/templates/deployment.yaml +++ b/pkg/helm/templates/deployment.yaml @@ -66,7 +66,7 @@ spec: {{- if .Values.persistence.enabled }} - name: data persistentVolumeClaim: - claimName: {{ template "pgadmin4.fullname" . }} + claimName: {{ .Values.persistence.existingClaim | default (include "pgadmin4.fullname" .) }} {{- end }} {{- if .Values.config_local.enabled }} - name: config-local diff --git a/pkg/helm/templates/pvc.yaml b/pkg/helm/templates/pvc.yaml index 74cc7c40ee0..ffbe215ccdd 100644 --- a/pkg/helm/templates/pvc.yaml +++ b/pkg/helm/templates/pvc.yaml @@ -1,4 +1,4 @@ -{{- if .Values.persistence.enabled }} +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -17,4 +17,4 @@ spec: requests: storage: {{ .Values.persistence.size }} accessModes: {{ .Values.persistence.accessModes }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/pkg/helm/values.yaml b/pkg/helm/values.yaml index cedbb2bb994..47b8da5bf74 100644 --- a/pkg/helm/values.yaml +++ b/pkg/helm/values.yaml @@ -88,6 +88,7 @@ persistence: size: 1Gi storageClass: "" accessModes: ["ReadWriteOnce"] + existingClaim: "" service: type: ClusterIP @@ -179,4 +180,3 @@ containerSecurityContext: type: RuntimeDefault windowsOptions: hostProcess: false -