From 06a449bab3f4713a83f0415f5013bb5602e72e1f Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Fri, 6 Dec 2019 18:27:53 +0100 Subject: [SO] Use global storage templates for PVC OOM has now templates in order to create the needed PVC, using: * a PV with a specific class when using a common nfs mount path between nodes (sames as today use) --> is the default behavior today * or a storage class if we want to use dynamic PV. On this case, we use (in order of priority): - persistence.storageClassOverride if set on the chart - global.persistence.storageClass if set globally - persistence.storageClass if set on the chart Change-Id: Ice44eda13aad44564d61f9e954cd11085a81d56f Issue-ID: OOM-1227 Signed-off-by: Sylvain Desbureaux --- kubernetes/so/charts/so-mariadb/templates/pv.yaml | 1 + kubernetes/so/charts/so-mariadb/templates/pvc.yaml | 12 +----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/kubernetes/so/charts/so-mariadb/templates/pv.yaml b/kubernetes/so/charts/so-mariadb/templates/pv.yaml index 5f5d09e2eb..f8315ef5f9 100644 --- a/kubernetes/so/charts/so-mariadb/templates/pv.yaml +++ b/kubernetes/so/charts/so-mariadb/templates/pv.yaml @@ -36,6 +36,7 @@ spec: accessModes: - {{ .Values.persistence.accessMode }} persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} + storageClassName: "{{ include "common.fullname" . }}-data" hostPath: path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} {{- end }} diff --git a/kubernetes/so/charts/so-mariadb/templates/pvc.yaml b/kubernetes/so/charts/so-mariadb/templates/pvc.yaml index 92d5eed0c4..17ff7730c7 100644 --- a/kubernetes/so/charts/so-mariadb/templates/pvc.yaml +++ b/kubernetes/so/charts/so-mariadb/templates/pvc.yaml @@ -33,20 +33,10 @@ metadata: {{ toYaml .Values.persistence.annotations | indent 4 }} {{- end }} spec: - selector: - matchLabels: - name: {{ include "common.fullname" . }}-migration accessModes: - {{ .Values.persistence.accessMode }} resources: requests: storage: {{ .Values.persistence.size }} -{{- if .Values.persistence.storageClass }} -{{- if (eq "-" .Values.persistence.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" + storageClassName: {{ include "common.storageClass" . }} {{- end }} -{{- end }} -{{- end }} - -- cgit 1.2.3-korg