From 10e32caa0ae09922e8200b59b57476630e2f8fef 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:44 +0100 Subject: [PATCH] [stable/drupal] Use global registry in secondary and/or metrics images (#12254) Signed-off-by: Carlos Rodriguez Hernandez --- stable/drupal/Chart.yaml | 2 +- stable/drupal/templates/_helpers.tpl | 19 ++++++++++++++++--- stable/drupal/templates/deployment.yaml | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/stable/drupal/Chart.yaml b/stable/drupal/Chart.yaml index 75a24ac0de..58ceeb1e0b 100644 --- a/stable/drupal/Chart.yaml +++ b/stable/drupal/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: drupal -version: 3.1.2 +version: 3.2.0 appVersion: 8.6.12 description: One of the most versatile open source content management systems. keywords: diff --git a/stable/drupal/templates/_helpers.tpl b/stable/drupal/templates/_helpers.tpl index 63a94a3927..933ca769eb 100644 --- a/stable/drupal/templates/_helpers.tpl +++ b/stable/drupal/templates/_helpers.tpl @@ -56,11 +56,24 @@ Also, we can't use a single if because lazy evaluation is not an option {{/* Return the proper image name (for the metrics image) */}} -{{- define "metrics.image" -}} -{{- $registryName := .Values.metrics.image.registry -}} +{{- define "drupal.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 -}} {{/* diff --git a/stable/drupal/templates/deployment.yaml b/stable/drupal/templates/deployment.yaml index 83d8e6f834..c22aeec8b9 100644 --- a/stable/drupal/templates/deployment.yaml +++ b/stable/drupal/templates/deployment.yaml @@ -114,7 +114,7 @@ spec: {{- end }} {{- if .Values.metrics.enabled }} - name: metrics - image: {{ template "metrics.image" . }} + image: {{ template "drupal.metrics.image" . }} imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} command: [ '/bin/apache_exporter', '-scrape_uri', 'http://status.localhost:80/server-status/?auto'] ports: