From 5ef4e566b0ddcc0b257bed454b817bd1202f95db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Cabrera=20Mi=C3=B1agorri?= Date: Wed, 21 Aug 2019 16:37:29 +0200 Subject: [PATCH] [stable/redis] Refactor StorageClass template to support old Helm versions (#16480) * Refactor StorageClass template to support old Helm versions Signed-off-by: Miguel A. Cabrera Minagorri * [stable/redis] Update components versions Signed-off-by: Bitnami Containers --- stable/redis/Chart.yaml | 2 +- stable/redis/templates/_helpers.tpl | 74 ++++++++++++++++++++--------- stable/redis/values-production.yaml | 4 +- stable/redis/values.yaml | 4 +- 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/stable/redis/Chart.yaml b/stable/redis/Chart.yaml index 665b2649fe..434d65d370 100644 --- a/stable/redis/Chart.yaml +++ b/stable/redis/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: redis -version: 9.1.0 +version: 9.1.1 appVersion: 5.0.5 description: Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. keywords: diff --git a/stable/redis/templates/_helpers.tpl b/stable/redis/templates/_helpers.tpl index 8467348247..e5d53785e6 100644 --- a/stable/redis/templates/_helpers.tpl +++ b/stable/redis/templates/_helpers.tpl @@ -239,41 +239,71 @@ WARNING: Rolling tag detected ({{ .Values.sentinel.image.repository }}:{{ .Value {{- end -}} {{/* -Return the proper Storage Class +Return the proper Storage Class for master */}} {{- define "redis.master.storageClass" -}} -{{- $storageClass := "" }} -{{- if .Values.master.persistence.storageClass -}} - {{- $storageClass = .Values.master.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.master.persistence.storageClass -}} + {{- if (eq "-" .Values.master.persistence.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.master.persistence.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.master.persistence.storageClass -}} + {{- if (eq "-" .Values.master.persistence.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.master.persistence.storageClass -}} + {{- end -}} {{- end -}} -{{- end -}} -{{- if (eq "-" $storageClass) -}} - {{- printf "\"\"" -}} -{{- else }} - {{- printf "%s" $storageClass -}} {{- end -}} {{- end -}} {{/* -Return the proper Storage Class +Return the proper Storage Class for slave */}} {{- define "redis.slave.storageClass" -}} -{{- $storageClass := "" }} -{{- if .Values.slave.persistence.storageClass -}} - {{- $storageClass = .Values.slave.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.slave.persistence.storageClass -}} + {{- if (eq "-" .Values.slave.persistence.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.slave.persistence.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.slave.persistence.storageClass -}} + {{- if (eq "-" .Values.slave.persistence.storageClass) -}} + {{- printf "\"\"" -}} + {{- else }} + {{- printf "%s" .Values.slave.persistence.storageClass -}} + {{- end -}} {{- end -}} {{- end -}} -{{- if (eq "-" $storageClass) -}} - {{- printf "\"\"" -}} -{{- else }} - {{- printf "%s" $storageClass -}} -{{- end -}} {{- end -}} diff --git a/stable/redis/values-production.yaml b/stable/redis/values-production.yaml index b3dd0bfac4..fcddf3b4bd 100644 --- a/stable/redis/values-production.yaml +++ b/stable/redis/values-production.yaml @@ -17,7 +17,7 @@ image: ## Bitnami Redis image tag ## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links ## - tag: 5.0.5-debian-9-r95 + tag: 5.0.5-debian-9-r104 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -443,7 +443,7 @@ metrics: image: registry: docker.io repository: bitnami/redis-exporter - tag: 1.0.4-debian-9-r4 + tag: 1.1.0-debian-9-r1 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. diff --git a/stable/redis/values.yaml b/stable/redis/values.yaml index 4fd33f581f..608ca23355 100644 --- a/stable/redis/values.yaml +++ b/stable/redis/values.yaml @@ -17,7 +17,7 @@ image: ## Bitnami Redis image tag ## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links ## - tag: 5.0.5-debian-9-r95 + tag: 5.0.5-debian-9-r104 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -443,7 +443,7 @@ metrics: image: registry: docker.io repository: bitnami/redis-exporter - tag: 1.0.4-debian-9-r4 + tag: 1.1.0-debian-9-r1 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace.