From e72084feadd5aabbcd24adf59ee85d2aa23f8392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Cabrera=20Mi=C3=B1agorri?= Date: Wed, 21 Aug 2019 16:37:48 +0200 Subject: [PATCH] [stable/mediawiki] Refactor StorageClass template to support old Helm versions (#16486) Signed-off-by: miguelaeh --- stable/mediawiki/Chart.yaml | 2 +- stable/mediawiki/templates/_helpers.tpl | 35 ++++++++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/stable/mediawiki/Chart.yaml b/stable/mediawiki/Chart.yaml index 5de67180ee..c83804bfc3 100644 --- a/stable/mediawiki/Chart.yaml +++ b/stable/mediawiki/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: mediawiki -version: 8.1.0 +version: 8.1.1 appVersion: 1.33.0 description: Extremely powerful, scalable software and a feature-rich wiki implementation that uses PHP to process and display data stored in a database. home: http://www.mediawiki.org/ diff --git a/stable/mediawiki/templates/_helpers.tpl b/stable/mediawiki/templates/_helpers.tpl index f83c43c9d6..4f18c35257 100644 --- a/stable/mediawiki/templates/_helpers.tpl +++ b/stable/mediawiki/templates/_helpers.tpl @@ -123,18 +123,33 @@ imagePullSecrets: Return the proper Storage Class */}} {{- define "mediawiki.storageClass" -}} -{{- $storageClass := "" }} -{{- if .Values.persistence.storageClass -}} - {{- $storageClass = .Values.persistence.storageClass -}} -{{- end -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +*/}} {{- if .Values.global -}} {{- if .Values.global.storageClass -}} - {{- $storageClass = .Values.global.storageClass -}} + {{- if (eq "-" .Values.global.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.global.storageClass -}} + {{- end -}} + {{- else -}} + {{- if .Values.persistence.storageClass -}} + {{- if (eq "-" .Values.persistence.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.persistence.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.persistence.storageClass -}} + {{- if (eq "-" .Values.persistence.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.persistence.storageClass -}} + {{- end -}} {{- end -}} {{- end -}} -{{- if (eq "-" $storageClass) -}} - {{- printf "\"\"" -}} -{{- else }} - {{- printf "%s" $storageClass -}} -{{- end -}} {{- end -}}