From c2f8fee19ffd569b59626a0d6a1fa8abf8bab3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Cabrera=20Mi=C3=B1agorri?= Date: Wed, 21 Aug 2019 19:48:46 +0200 Subject: [PATCH] [stable/jasperreports] Refactor StorageClass template to support old Helm versions (#16498) Signed-off-by: miguelaeh --- stable/jasperreports/Chart.yaml | 2 +- stable/jasperreports/templates/_helpers.tpl | 35 +++++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/stable/jasperreports/Chart.yaml b/stable/jasperreports/Chart.yaml index a0fd1f507e..c4e7871d90 100644 --- a/stable/jasperreports/Chart.yaml +++ b/stable/jasperreports/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: jasperreports -version: 6.1.0 +version: 6.1.1 appVersion: 7.2.0 description: The JasperReports server can be used as a stand-alone or embedded reporting and BI server that offers web-based reporting, analytic tools and visualization, diff --git a/stable/jasperreports/templates/_helpers.tpl b/stable/jasperreports/templates/_helpers.tpl index 0f080caefe..f12ff3170e 100644 --- a/stable/jasperreports/templates/_helpers.tpl +++ b/stable/jasperreports/templates/_helpers.tpl @@ -94,18 +94,33 @@ imagePullSecrets: Return the proper Storage Class */}} {{- define "jasperreports.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 -}}