From 4aabebe29f3cc187abdea82675122c7fd39b22b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Cabrera=20Mi=C3=B1agorri?= Date: Wed, 21 Aug 2019 17:07:45 +0200 Subject: [PATCH] [stable/osclass] Refactor StorageClass template to support old Helm versions (#16488) Signed-off-by: miguelaeh --- stable/osclass/Chart.yaml | 2 +- stable/osclass/templates/_helpers.tpl | 35 +++++++++++++++++++-------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/stable/osclass/Chart.yaml b/stable/osclass/Chart.yaml index ad0bbde96d..da5d92e3a8 100644 --- a/stable/osclass/Chart.yaml +++ b/stable/osclass/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: osclass -version: 6.1.0 +version: 6.1.1 appVersion: 3.7.4 description: Osclass is a php script that allows you to quickly create and manage your own free classifieds site. diff --git a/stable/osclass/templates/_helpers.tpl b/stable/osclass/templates/_helpers.tpl index 35c0ef57cf..ba3e322554 100644 --- a/stable/osclass/templates/_helpers.tpl +++ b/stable/osclass/templates/_helpers.tpl @@ -145,18 +145,33 @@ imagePullSecrets: Return the proper Storage Class */}} {{- define "osclass.storageClass" -}} -{{- $storageClass := "" }} -{{- if .Values.persistence.osclass.storageClass -}} - {{- $storageClass = .Values.persistence.osclass.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.osclass.torageClass -}} + {{- if (eq "-" .Values.persistence.osclass.torageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.persistence.osclass.torageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.persistence.osclass.torageClass -}} + {{- if (eq "-" .Values.persistence.osclass.torageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.persistence.osclass.torageClass -}} + {{- end -}} {{- end -}} {{- end -}} -{{- if (eq "-" $storageClass) -}} - {{- printf "\"\"" -}} -{{- else }} - {{- printf "%s" $storageClass -}} -{{- end -}} {{- end -}}