From 0f3900a27b91eb41ba8b432efd3da0f5be5b11d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Fri, 15 Mar 2019 09:12:58 +0100 Subject: [PATCH] [stable/dokuwiki] Use global registry in secondary and/or metrics images (#12232) Signed-off-by: Carlos Rodriguez Hernandez --- stable/dokuwiki/Chart.yaml | 2 +- stable/dokuwiki/templates/_helpers.tpl | 19 ++++++++++++++++--- stable/dokuwiki/templates/deployment.yaml | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/stable/dokuwiki/Chart.yaml b/stable/dokuwiki/Chart.yaml index c6be4c90f4..a2805edba4 100644 --- a/stable/dokuwiki/Chart.yaml +++ b/stable/dokuwiki/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: dokuwiki -version: 4.1.1 +version: 4.2.0 appVersion: 0.20180422.201901061035 description: DokuWiki is a standards-compliant, simple to use wiki optimized for creating documentation. It is targeted at developer teams, workgroups, and small companies. diff --git a/stable/dokuwiki/templates/_helpers.tpl b/stable/dokuwiki/templates/_helpers.tpl index 38f3f2bfaf..836064c9a9 100644 --- a/stable/dokuwiki/templates/_helpers.tpl +++ b/stable/dokuwiki/templates/_helpers.tpl @@ -48,11 +48,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 "dokuwiki.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/dokuwiki/templates/deployment.yaml b/stable/dokuwiki/templates/deployment.yaml index 66d3210cba..e87356ba82 100644 --- a/stable/dokuwiki/templates/deployment.yaml +++ b/stable/dokuwiki/templates/deployment.yaml @@ -99,7 +99,7 @@ spec: mountPath: /bitnami/apache {{- if .Values.metrics.enabled }} - name: metrics - image: {{ template "metrics.image" . }} + image: {{ template "dokuwiki.metrics.image" . }} imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} command: [ '/bin/apache_exporter', '-scrape_uri', 'http://status.localhost:80/server-status/?auto'] ports: