From 7d2508813ec713a23131799e5258187fe8efbb60 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Thu, 5 Dec 2019 16:34:49 +0100 Subject: [LOG] 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: I1f39f2c8c9a2d4fe1303fffbefe4dac70ed0e860 Issue-ID: OOM-1227 Signed-off-by: Sylvain Desbureaux --- kubernetes/log/charts/log-elasticsearch/templates/pv.yaml | 3 ++- kubernetes/log/charts/log-elasticsearch/templates/pvc.yaml | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/kubernetes/log/charts/log-elasticsearch/templates/pv.yaml b/kubernetes/log/charts/log-elasticsearch/templates/pv.yaml index fd21cdfc1f..fdea287cbd 100644 --- a/kubernetes/log/charts/log-elasticsearch/templates/pv.yaml +++ b/kubernetes/log/charts/log-elasticsearch/templates/pv.yaml @@ -17,7 +17,7 @@ kind: PersistentVolume apiVersion: v1 metadata: - name: {{ include "common.fullname" . }} + name: {{ include "common.fullname" . }}-data namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.name" . }} @@ -31,6 +31,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/log/charts/log-elasticsearch/templates/pvc.yaml b/kubernetes/log/charts/log-elasticsearch/templates/pvc.yaml index abab145a8f..d2eddc227d 100644 --- a/kubernetes/log/charts/log-elasticsearch/templates/pvc.yaml +++ b/kubernetes/log/charts/log-elasticsearch/templates/pvc.yaml @@ -29,11 +29,9 @@ metadata: {{ toYaml .Values.persistence.annotations | indent 4 }} {{- end }} spec: - selector: - matchLabels: - name: {{ include "common.fullname" . }} accessModes: - {{ .Values.persistence.accessMode }} + storageClassName: {{ include "common.storageClass" . }} resources: requests: storage: {{ .Values.persistence.size }} -- cgit 1.2.3-korg