From 342f88afbf01d18dfa954b66d440045f321c9030 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Tue, 23 Nov 2021 11:21:13 +0100 Subject: [PATCH] fix(common): ensure storageClassName gets rendered correctly (#1385) * fix(common): ensure storageClassName gets rendered correctly * Add a canary test to common * remove canary for now --- charts/library/common/Chart.yaml | 2 +- .../common/templates/lib/utils/_storage.tpl | 40 +++++++++---------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 281b92423fb..a2ad59c243a 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 8.9.1 +version: 8.9.2 diff --git a/charts/library/common/templates/lib/utils/_storage.tpl b/charts/library/common/templates/lib/utils/_storage.tpl index 52e25089852..2ffd800c7fe 100644 --- a/charts/library/common/templates/lib/utils/_storage.tpl +++ b/charts/library/common/templates/lib/utils/_storage.tpl @@ -6,34 +6,30 @@ Return the proper Storage Class {{- define "common.storage.class" -}} {{- $storageClass := .persistence.storageClass -}} +{{- $output := "" -}} {{- if $storageClass -}} {{- if (eq "-" $storageClass) -}} - {{- printf "storageClassName: \"\"" -}} + {{- $output = "\"\"" -}} {{- else if (eq "SCALE-ZFS" $storageClass ) }} - {{- ( printf "storageClassName: ix-storage-class-%s" .global.Release.Name ) -}} + {{- $output = ( printf "ix-storage-class-%s" .global.Release.Name ) -}} {{- else }} - {{- printf "storageClassName: %s" $storageClass -}} + {{- $output = $storageClass -}} + {{- end -}} +{{- else if .global }} + {{- if .global.Values.storageClass -}} + {{- $output = .global.Values.storageClass -}} + {{- else if .global.Values.ixChartContext }} + {{- $output = ( printf "ix-storage-class-%s" .global.Release.Name ) -}} + {{- else if .global.Values.global -}} + {{- if .global.Values.global.storageClass -}} + {{- $output = .global.Values.global.storageClass -}} + {{- end -}} + {{- if or ( .global.Values.global.ixChartContext ) ( .global.Values.global.isSCALE ) -}} + {{- $output = ( printf "ix-storage-class-%s" .global.Release.Name ) -}} + {{- end }} {{- end -}} {{- end -}} - -{{- if .global }} -{{- if .global.Values.global -}} - {{- if .global.Values.global.storageClass -}} - {{- $storageClass = .global.Values.global.storageClass -}} - {{- end -}} - {{- if or ( .global.Values.global.ixChartContext ) ( .global.Values.global.isSCALE ) -}} - {{- ( printf "storageClassName: ix-storage-class-%s" .global.Release.Name ) -}} - {{- end }} -{{- end -}} - -{{- if .global.Values.storageClass -}} - {{- $storageClass = .global.Values.storageClass -}} -{{- end -}} - -{{- if .global.Values.ixChartContext }} - {{- ( printf "storageClassName: ix-storage-class-%s" .global.Release.Name ) -}} -{{- end }} -{{- end }} +{{- printf "storageClassName: %s" $output -}} {{- end -}}