From b2e38d92536397edad743715e794439cda520be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Fri, 15 Mar 2019 10:15:32 +0100 Subject: [PATCH] [stable/orangehrm] Use global registry in secondary and/or metrics images (#12247) Signed-off-by: Carlos Rodriguez Hernandez --- stable/orangehrm/Chart.yaml | 2 +- stable/orangehrm/templates/_helpers.tpl | 19 ++++++++++++++++--- stable/orangehrm/templates/deployment.yaml | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/stable/orangehrm/Chart.yaml b/stable/orangehrm/Chart.yaml index edf1a54406..e2c460da4c 100644 --- a/stable/orangehrm/Chart.yaml +++ b/stable/orangehrm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: orangehrm -version: 4.1.0 +version: 4.2.0 appVersion: 4.3.0-0 description: OrangeHRM is a free HR management system that offers a wealth of modules to suit the needs of your business. diff --git a/stable/orangehrm/templates/_helpers.tpl b/stable/orangehrm/templates/_helpers.tpl index 8a6bd292db..309d9ab8f9 100644 --- a/stable/orangehrm/templates/_helpers.tpl +++ b/stable/orangehrm/templates/_helpers.tpl @@ -49,11 +49,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 "orangehrm.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/orangehrm/templates/deployment.yaml b/stable/orangehrm/templates/deployment.yaml index c4538e1303..7bbfe09e05 100644 --- a/stable/orangehrm/templates/deployment.yaml +++ b/stable/orangehrm/templates/deployment.yaml @@ -113,7 +113,7 @@ spec: mountPath: /bitnami/apache {{- if .Values.metrics.enabled }} - name: metrics - image: {{ template "metrics.image" . }} + image: {{ template "orangehrm.metrics.image" . }} imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} command: [ '/bin/apache_exporter', '-scrape_uri', 'http://status.localhost:80/server-status/?auto'] ports: