From f05391fcc545dd689fce80b18809d01809cfd3fa Mon Sep 17 00:00:00 2001 From: hanchenli Date: Sun, 16 Feb 2025 23:56:06 +0000 Subject: [PATCH] [Feat] Added support for modifying PVC through values.yaml Signed-off-by: hanchenli --- helm/Chart.yaml | 2 +- helm/templates/pvc.yaml | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index adcd67f..9fdc579 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.5 +version: 0.0.6 maintainers: - name: apostac diff --git a/helm/templates/pvc.yaml b/helm/templates/pvc.yaml index 1d6f432..aab12af 100644 --- a/helm/templates/pvc.yaml +++ b/helm/templates/pvc.yaml @@ -5,11 +5,27 @@ kind: PersistentVolumeClaim metadata: name: "{{ .Release.Name }}-{{$modelSpec.name}}-storage-claim" namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/managed-by: Helm + annotations: + meta.helm.sh/release-name: "{{ .Release.Name }}" + meta.helm.sh/release-namespace: "{{ .Release.Namespace }}" +{{- if $modelSpec.pvcAnnotations }} + {{- toYaml $modelSpec.pvcAnnotations | nindent 4 }} +{{- end }} spec: - accessModes: {{ toYaml $modelSpec.pvcAccessMode | nindent 4 }} + accessModes: + {{- if $modelSpec.pvcAccessMode }} + {{- toYaml $modelSpec.pvcAccessMode | nindent 4 }} + {{- else }} + - ReadWriteOnce # Default to EBS-compatible mode if not specified + {{- end }} resources: requests: - storage: {{ $modelSpec.pvcStorage }} + storage: {{ $modelSpec.pvcStorage | default "10Gi" }} # Default to 10Gi if not set + {{- if $modelSpec.storageClass }} + storageClassName: "{{ $modelSpec.storageClass }}" # Allow user-defined storageClass + {{- end }} {{- if not (empty $modelSpec.pvcMatchLabels) }} selector: matchLabels: @@ -17,4 +33,4 @@ spec: {{- end }} {{- end }} --- -{{- end }} +{{- end }} \ No newline at end of file