From 25cdbe955ff1cc8c83c7102fbb7d770ba4778700 Mon Sep 17 00:00:00 2001 From: unlightable Date: Sat, 7 Oct 2023 19:39:57 +0500 Subject: [PATCH] Chart value `bindPVThroughClaimRef` to control how PV / PVC pairs are bound. `true` uses partially pre-filled spec.claimRef in PV `false` fills spec.volumeName of PVC instead --- charts/core-dump-handler/templates/core-storage-pv.yaml | 2 ++ charts/core-dump-handler/templates/core-storage-pvc.yaml | 3 +++ charts/core-dump-handler/templates/event-storage-pv.yaml | 2 ++ charts/core-dump-handler/templates/event-storage-pvc.yaml | 3 +++ charts/core-dump-handler/templates/host-storage-pv.yaml | 2 ++ charts/core-dump-handler/templates/host-storage-pvc.yaml | 3 +++ charts/core-dump-handler/values.yaml | 2 ++ 7 files changed, 17 insertions(+) diff --git a/charts/core-dump-handler/templates/core-storage-pv.yaml b/charts/core-dump-handler/templates/core-storage-pv.yaml index c8ed150..829c61c 100644 --- a/charts/core-dump-handler/templates/core-storage-pv.yaml +++ b/charts/core-dump-handler/templates/core-storage-pv.yaml @@ -6,9 +6,11 @@ metadata: type: local spec: storageClassName: {{ .Values.storageClass }} +{{ if .Values.bindPVThroughClaimRef }} claimRef: name: core-storage-pvc namespace: {{ .Release.Namespace }} +{{ end }} capacity: storage: {{ .Values.coreStorage }} accessModes: diff --git a/charts/core-dump-handler/templates/core-storage-pvc.yaml b/charts/core-dump-handler/templates/core-storage-pvc.yaml index 524506f..2a8f7c9 100644 --- a/charts/core-dump-handler/templates/core-storage-pvc.yaml +++ b/charts/core-dump-handler/templates/core-storage-pvc.yaml @@ -9,3 +9,6 @@ spec: requests: storage: {{ .Values.coreStorage }} storageClassName: {{ .Values.storageClass }} +{{ if not .Values.bindPVThroughClaimRef }} + volumeName: core-volume +{{ end }} diff --git a/charts/core-dump-handler/templates/event-storage-pv.yaml b/charts/core-dump-handler/templates/event-storage-pv.yaml index e620862..979606a 100644 --- a/charts/core-dump-handler/templates/event-storage-pv.yaml +++ b/charts/core-dump-handler/templates/event-storage-pv.yaml @@ -7,9 +7,11 @@ metadata: type: local spec: storageClassName: {{ .Values.storageClass }} +{{ if .Values.bindPVThroughClaimRef }} claimRef: name: event-storage-pvc namespace: {{ .Release.Namespace }} +{{ end }} capacity: storage: {{ .Values.eventStorage }} accessModes: diff --git a/charts/core-dump-handler/templates/event-storage-pvc.yaml b/charts/core-dump-handler/templates/event-storage-pvc.yaml index a49e2b9..7367991 100644 --- a/charts/core-dump-handler/templates/event-storage-pvc.yaml +++ b/charts/core-dump-handler/templates/event-storage-pvc.yaml @@ -10,4 +10,7 @@ spec: requests: storage: {{ .Values.eventStorage }} storageClassName: {{ .Values.storageClass }} +{{ if not .Values.bindPVThroughClaimRef }} + volumeName: event-volume +{{ end }} {{ end }} diff --git a/charts/core-dump-handler/templates/host-storage-pv.yaml b/charts/core-dump-handler/templates/host-storage-pv.yaml index 2e69897..cf5cfe4 100644 --- a/charts/core-dump-handler/templates/host-storage-pv.yaml +++ b/charts/core-dump-handler/templates/host-storage-pv.yaml @@ -6,9 +6,11 @@ metadata: type: local spec: storageClassName: {{ .Values.storageClass }} +{{ if .Values.bindPVThroughClaimRef }} claimRef: name: host-storage-pvc namespace: {{ .Release.Namespace }} +{{ end }} capacity: storage: {{ .Values.hostStorage }} accessModes: diff --git a/charts/core-dump-handler/templates/host-storage-pvc.yaml b/charts/core-dump-handler/templates/host-storage-pvc.yaml index 8e69caa..c7eb39a 100644 --- a/charts/core-dump-handler/templates/host-storage-pvc.yaml +++ b/charts/core-dump-handler/templates/host-storage-pvc.yaml @@ -9,3 +9,6 @@ spec: requests: storage: {{ .Values.hostStorage }} storageClassName: {{ .Values.storageClass }} +{{ if not .Values.bindPVThroughClaimRef }} + volumeName: host-volume +{{ end }} diff --git a/charts/core-dump-handler/values.yaml b/charts/core-dump-handler/values.yaml index d508266..d7ee907 100644 --- a/charts/core-dump-handler/values.yaml +++ b/charts/core-dump-handler/values.yaml @@ -20,6 +20,8 @@ hostStorage: 1Gi coreStorage: 10Gi eventStorage: 1Gi storageClass: hostclass +# set claimRef on PersistentVolume or fallback to /spec/volumeName on PVC +bindPVThroughClaimRef: true composer: ignoreCrio: false