[stable/mongodb] Refactor StorageClass template to support old Helm versions (#16507)

Signed-off-by: miguelaeh <macabrera@bitnami.com>
This commit is contained in:
Miguel Ángel Cabrera Miñagorri
2019-08-21 06:07:18 -07:00
committed by Kubernetes Prow Robot
parent b3cabd44ae
commit 0e79280415
2 changed files with 26 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: mongodb
version: 7.2.0
version: 7.2.1
appVersion: 4.0.12
description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications.
keywords:
+25 -10
View File
@@ -195,18 +195,33 @@ mongodb: mongodbUsername, mongodbDatabase
Return the proper Storage Class
*/}}
{{- define "mongodb.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 -}}