summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2019-12-09 11:49:36 +0100
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>2019-12-09 11:49:36 +0100
commita58fe83cfbf60ae058819daf7e6d942f96e603cf (patch)
tree421fac87f7636b7cc7f605e87a739d9e2328ce15
parent868374dc9e41555fa9e75a0ca63deb7cd6780ab9 (diff)
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 Issue-ID: OOM-1227 Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com> Change-Id: Ie65e55bca92eb0ada674636f049ecb054b65c5da
-rw-r--r--templates/pv.yaml3
-rw-r--r--templates/pvc.yaml11
2 files changed, 4 insertions, 10 deletions
diff --git a/templates/pv.yaml b/templates/pv.yaml
index 184728f..63829cb 100644
--- a/templates/pv.yaml
+++ b/templates/pv.yaml
@@ -15,6 +15,7 @@
*/}}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
+{{- if eq "True" (include "common.needPV" .) -}}
kind: PersistentVolume
apiVersion: v1
metadata:
@@ -31,7 +32,9 @@ spec:
storage: {{ .Values.persistence.size}}
accessModes:
- {{ .Values.persistence.accessMode }}
+ storageClassName: "{{ include "common.fullname" . }}-data"
persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
hostPath:
path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
{{- end -}}
+{{- end -}}
diff --git a/templates/pvc.yaml b/templates/pvc.yaml
index e27c331..e21babb 100644
--- a/templates/pvc.yaml
+++ b/templates/pvc.yaml
@@ -30,19 +30,10 @@ 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 }}
-{{- if .Values.persistence.storageClass }}
-{{- if (eq "-" .Values.persistence.storageClass) }}
- storageClassName: ""
-{{- else }}
- storageClassName: "{{ .Values.persistence.storageClass }}"
-{{- end }}
-{{- end }}
{{- end -}}