From dec85437845211a047def7ed3d704f88d3f5c642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Cabrera=20Mi=C3=B1agorri?= Date: Wed, 21 Aug 2019 15:41:42 +0200 Subject: [PATCH] [stable/dokuwiki] Refactor StorageClass template to support old Helm versions (#16504) Signed-off-by: miguelaeh --- stable/dokuwiki/Chart.yaml | 2 +- stable/dokuwiki/templates/_helpers.tpl | 35 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/stable/dokuwiki/Chart.yaml b/stable/dokuwiki/Chart.yaml index ebd7eb7325..9111246d5d 100644 --- a/stable/dokuwiki/Chart.yaml +++ b/stable/dokuwiki/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: dokuwiki -version: 5.2.0 +version: 5.2.1 appVersion: 0.20180422.201901061035 description: DokuWiki is a standards-compliant, simple to use wiki optimized for creating documentation. It is targeted at developer teams, workgroups, and small companies. diff --git a/stable/dokuwiki/templates/_helpers.tpl b/stable/dokuwiki/templates/_helpers.tpl index f35b2be6cb..1e094cb031 100644 --- a/stable/dokuwiki/templates/_helpers.tpl +++ b/stable/dokuwiki/templates/_helpers.tpl @@ -115,18 +115,33 @@ imagePullSecrets: Return the proper Storage Class */}} {{- define "dokuwiki.storageClass" -}} -{{- $storageClass := "" }} -{{- if .Values.persistence.dokuwiki.storageClass -}} - {{- $storageClass = .Values.persistence.dokuwiki.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.dokuwiki.storageClass -}} + {{- if (eq "-" .Values.persistence.dokuwiki.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.persistence.dokuwiki.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.persistence.dokuwiki.storageClass -}} + {{- if (eq "-" .Values.persistence.dokuwiki.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.persistence.dokuwiki.storageClass -}} + {{- end -}} {{- end -}} {{- end -}} -{{- if (eq "-" $storageClass) -}} - {{- printf "\"\"" -}} -{{- else }} - {{- printf "%s" $storageClass -}} -{{- end -}} {{- end -}}