diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2019-12-09 11:17:00 +0100 |
---|---|---|
committer | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2019-12-09 11:17:00 +0100 |
commit | 2a15323766f8f6d8ea32ff730672ff7acee11116 (patch) | |
tree | f8bcb260e8eb8f8c5a355855a9b6491140400e38 | |
parent | 72c71c0b832a169c03bcdbaa5997956e30f62c7c (diff) |
[PORTAL] 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: I28b4ac5f612de75918973148865cf82f7a7de5e8
Issue-ID: OOM-1227
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
4 files changed, 8 insertions, 20 deletions
diff --git a/kubernetes/portal/charts/portal-cassandra/templates/pv.yaml b/kubernetes/portal/charts/portal-cassandra/templates/pv.yaml index 252ca76599..f6119246ed 100644 --- a/kubernetes/portal/charts/portal-cassandra/templates/pv.yaml +++ b/kubernetes/portal/charts/portal-cassandra/templates/pv.yaml @@ -16,6 +16,7 @@ */}} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +{{- if eq "True" (include "common.needPV" .) -}} kind: PersistentVolume apiVersion: v1 metadata: @@ -33,6 +34,8 @@ 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 -}} +{{- end -}} diff --git a/kubernetes/portal/charts/portal-cassandra/templates/pvc.yaml b/kubernetes/portal/charts/portal-cassandra/templates/pvc.yaml index 1deed4e92a..a082319789 100644 --- a/kubernetes/portal/charts/portal-cassandra/templates/pvc.yaml +++ b/kubernetes/portal/charts/portal-cassandra/templates/pvc.yaml @@ -31,19 +31,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 -}} diff --git a/kubernetes/portal/charts/portal-mariadb/templates/pv.yaml b/kubernetes/portal/charts/portal-mariadb/templates/pv.yaml index 252ca76599..f6119246ed 100644 --- a/kubernetes/portal/charts/portal-mariadb/templates/pv.yaml +++ b/kubernetes/portal/charts/portal-mariadb/templates/pv.yaml @@ -16,6 +16,7 @@ */}} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +{{- if eq "True" (include "common.needPV" .) -}} kind: PersistentVolume apiVersion: v1 metadata: @@ -33,6 +34,8 @@ 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 -}} +{{- end -}} diff --git a/kubernetes/portal/charts/portal-mariadb/templates/pvc.yaml b/kubernetes/portal/charts/portal-mariadb/templates/pvc.yaml index 1deed4e92a..a082319789 100644 --- a/kubernetes/portal/charts/portal-mariadb/templates/pvc.yaml +++ b/kubernetes/portal/charts/portal-mariadb/templates/pvc.yaml @@ -31,19 +31,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 -}} |