From 812199acf011cd76f147dfc09b79909d8c144162 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Fri, 29 Nov 2019 15:06:44 +0100 Subject: [Contrib] 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: I278e62821ca98e41f63306e502cca1019ba18756 Issue-ID: OOM-1227 Signed-off-by: Sylvain Desbureaux --- .../charts/awx/charts/awx-postgres/templates/pv.yaml | 5 +++-- .../charts/awx/charts/awx-postgres/templates/pvc.yaml | 13 +------------ kubernetes/contrib/charts/awx/requirements.yaml | 2 +- .../charts/netbox/charts/netbox-app/templates/pv.yaml | 5 +++-- .../charts/netbox/charts/netbox-app/templates/pvc.yaml | 15 ++------------- .../netbox/charts/netbox-postgres/templates/pv.yaml | 5 +++-- .../netbox/charts/netbox-postgres/templates/pvc.yaml | 13 +------------ 7 files changed, 14 insertions(+), 44 deletions(-) (limited to 'kubernetes/contrib/charts') diff --git a/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pv.yaml b/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pv.yaml index a8cf9f6d9d..da68e3400c 100755 --- a/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pv.yaml +++ b/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pv.yaml @@ -15,7 +15,7 @@ */}} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} -{{- if not .Values.persistence.storageClass -}} +{{- if eq "True" (include "common.needPV" .) -}} kind: PersistentVolume apiVersion: v1 metadata: @@ -33,7 +33,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 -}} \ No newline at end of file +{{- end -}} diff --git a/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pvc.yaml b/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pvc.yaml index 52891ffda0..6d51a09232 100755 --- a/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pvc.yaml +++ b/kubernetes/contrib/charts/awx/charts/awx-postgres/templates/pvc.yaml @@ -30,21 +30,10 @@ metadata: {{ .Values.persistence.annotations | indent 4 }} {{- end }} spec: -{{- if not .Values.persistence.storageClass }} - selector: - matchLabels: - name: {{ include "common.fullname" . }} -{{- end }} 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/contrib/charts/awx/requirements.yaml b/kubernetes/contrib/charts/awx/requirements.yaml index 486fc6585c..ca8971c138 100755 --- a/kubernetes/contrib/charts/awx/requirements.yaml +++ b/kubernetes/contrib/charts/awx/requirements.yaml @@ -14,5 +14,5 @@ dependencies: - name: common - version: ~4.x-0 + version: ~5.x-0 repository: '@local' \ No newline at end of file diff --git a/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pv.yaml b/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pv.yaml index f741cba64c..d2783cc628 100755 --- a/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pv.yaml +++ b/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pv.yaml @@ -19,20 +19,21 @@ kind: PersistentVolume apiVersion: v1 metadata: - name: {{ .Release.Name }}-{{ .Values.persistence.staticPvName }} + name: {{ include "common.fullname" . }}-data namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" - name: {{ .Release.Name }}-{{ .Values.persistence.staticPvName }} + name: {{ include "common.fullname" . }} spec: capacity: storage: {{ .Values.persistence.size}} 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 }}/app {{- end -}} diff --git a/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pvc.yaml b/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pvc.yaml index 3489049602..a72d8277a4 100755 --- a/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pvc.yaml +++ b/kubernetes/contrib/charts/netbox/charts/netbox-app/templates/pvc.yaml @@ -30,21 +30,10 @@ metadata: {{ .Values.persistence.annotations | indent 4 }} {{- end }} spec: -{{- if not .Values.persistence.storageClass }} - selector: - matchLabels: - name: {{ .Release.Name }}-{{ .Values.persistence.staticPvName }} -{{- end }} 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 }}" - {{- end }} - {{- end }} -{{- end -}} \ No newline at end of file + storageClassName: {{ include "common.storageClass" . }} +{{- end -}} diff --git a/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pv.yaml b/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pv.yaml index a19f5001e5..9b6ee1b59a 100755 --- a/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pv.yaml +++ b/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pv.yaml @@ -15,7 +15,7 @@ */}} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} -{{- if not .Values.persistence.storageClass -}} +{{- if eq "True" (include "common.needPV" .) -}} kind: PersistentVolume apiVersion: v1 metadata: @@ -33,7 +33,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 -}} \ No newline at end of file +{{- end -}} diff --git a/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pvc.yaml b/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pvc.yaml index 30bba6da31..022a0fa8d8 100755 --- a/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pvc.yaml +++ b/kubernetes/contrib/charts/netbox/charts/netbox-postgres/templates/pvc.yaml @@ -30,21 +30,10 @@ metadata: {{ .Values.persistence.annotations | indent 4 }} {{- end }} spec: -{{- if not .Values.persistence.storageClass }} - selector: - matchLabels: - name: {{ include "common.fullname" . }} -{{- end }} 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 }}" -{{- end }} -{{- end }} + storageClassName: {{ include "common.storageClass" . }} {{- end -}} -- cgit 1.2.3-korg