From 7979dd1bce82c91fbf9f1c7569a319daf67217b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Fri, 15 Mar 2019 10:37:33 +0100 Subject: [PATCH] [stable/mariadb] Use global registry in secondary and/or metrics images (#12253) Signed-off-by: Carlos Rodriguez Hernandez --- stable/mariadb/Chart.yaml | 2 +- stable/mariadb/templates/_helpers.tpl | 19 ++++++++++++++++--- .../mariadb/templates/master-statefulset.yaml | 2 +- .../mariadb/templates/slave-statefulset.yaml | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/stable/mariadb/Chart.yaml b/stable/mariadb/Chart.yaml index bfd1763088..4cfbecc97e 100644 --- a/stable/mariadb/Chart.yaml +++ b/stable/mariadb/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: mariadb -version: 5.9.0 +version: 5.10.0 appVersion: 10.1.38 description: Fast, reliable, scalable, and easy to use open-source relational database system. MariaDB Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. Highly available MariaDB cluster. keywords: diff --git a/stable/mariadb/templates/_helpers.tpl b/stable/mariadb/templates/_helpers.tpl index a84f59d946..dcc3c83f84 100644 --- a/stable/mariadb/templates/_helpers.tpl +++ b/stable/mariadb/templates/_helpers.tpl @@ -66,11 +66,24 @@ Also, we can't use a single if because lazy evaluation is not an option {{/* Return the proper metrics image name */}} -{{- define "metrics.image" -}} -{{- $registryName := .Values.metrics.image.registry -}} +{{- define "mariadb.metrics.image" -}} +{{- $registryName := .Values.metrics.image.registry -}} {{- $repositoryName := .Values.metrics.image.repository -}} {{- $tag := .Values.metrics.image.tag | toString -}} -{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} {{- end -}} {{ template "mariadb.initdbScriptsCM" . }} diff --git a/stable/mariadb/templates/master-statefulset.yaml b/stable/mariadb/templates/master-statefulset.yaml index b311b27a84..6b830d77c4 100644 --- a/stable/mariadb/templates/master-statefulset.yaml +++ b/stable/mariadb/templates/master-statefulset.yaml @@ -166,7 +166,7 @@ spec: {{- end }} {{- if .Values.metrics.enabled }} - name: metrics - image: {{ template "metrics.image" . }} + image: {{ template "mariadb.metrics.image" . }} imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} env: - name: MARIADB_ROOT_PASSWORD diff --git a/stable/mariadb/templates/slave-statefulset.yaml b/stable/mariadb/templates/slave-statefulset.yaml index 0a350fd312..0ff1167dca 100644 --- a/stable/mariadb/templates/slave-statefulset.yaml +++ b/stable/mariadb/templates/slave-statefulset.yaml @@ -152,7 +152,7 @@ spec: {{- end }} {{- if .Values.metrics.enabled }} - name: metrics - image: {{ template "metrics.image" . }} + image: {{ template "mariadb.metrics.image" . }} imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} env: - name: MARIADB_MASTER_ROOT_PASSWORD