From f972e70b2e0ce9acccc8ade7c9daa79b703635c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Tue, 16 Oct 2018 10:59:10 +0200 Subject: [PATCH] [stable/orangehrm] Add global registry option (#8459) * [stable/orangehrm] Add global registry option Signed-off-by: Carlos Rodriguez Hernandez * Update deps Signed-off-by: Carlos Rodriguez Hernandez --- stable/orangehrm/Chart.yaml | 2 +- stable/orangehrm/README.md | 1 + stable/orangehrm/requirements.lock | 4 ++-- stable/orangehrm/templates/_helpers.tpl | 23 ++++++++++++++++++++++ stable/orangehrm/templates/deployment.yaml | 2 +- stable/orangehrm/values.yaml | 8 ++++++++ 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/stable/orangehrm/Chart.yaml b/stable/orangehrm/Chart.yaml index 8c8674e104..b8ae48eb10 100644 --- a/stable/orangehrm/Chart.yaml +++ b/stable/orangehrm/Chart.yaml @@ -1,5 +1,5 @@ name: orangehrm -version: 3.0.3 +version: 3.1.0 appVersion: 4.1.2 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/README.md b/stable/orangehrm/README.md index 4fcad2fee7..b3807115c9 100644 --- a/stable/orangehrm/README.md +++ b/stable/orangehrm/README.md @@ -49,6 +49,7 @@ The following table lists the configurable parameters of the OrangeHRM chart and | Parameter | Description | Default | |--------------------------------------|------------------------------------------|-------------------------------------------------------- | +| `global.imageRegistry` | Global Docker image registry | `nil` | | `image.registry` | OrangeHRM image registry | `docker.io` | | `image.repository` | OrangeHRM Image name | `bitnami/orangehrm` | | `image.tag` | OrangeHRM Image tag | `{VERSION}` | diff --git a/stable/orangehrm/requirements.lock b/stable/orangehrm/requirements.lock index 642aca3f29..18fcf3a13f 100644 --- a/stable/orangehrm/requirements.lock +++ b/stable/orangehrm/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: mariadb repository: https://kubernetes-charts.storage.googleapis.com/ - version: 5.0.4 + version: 5.2.0 digest: sha256:0593b73b2163fbbbae061de1aa2b8280d43f8a423a91e1c7375c0b6c86784b1c -generated: 2018-09-25T11:46:12.001683527+02:00 +generated: 2018-10-16T08:49:23.919504+02:00 diff --git a/stable/orangehrm/templates/_helpers.tpl b/stable/orangehrm/templates/_helpers.tpl index 421032bbe0..c1f57c5232 100644 --- a/stable/orangehrm/templates/_helpers.tpl +++ b/stable/orangehrm/templates/_helpers.tpl @@ -22,3 +22,26 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- define "orangehrm.mariadb.fullname" -}} {{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Return the proper OrangeHRM image name +*/}} +{{- define "orangehrm.image" -}} +{{- $registryName := .Values.image.registry -}} +{{- $repositoryName := .Values.image.repository -}} +{{- $tag := .Values.image.tag | toString -}} +{{/* +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 127f3c6715..cf4c8bded7 100644 --- a/stable/orangehrm/templates/deployment.yaml +++ b/stable/orangehrm/templates/deployment.yaml @@ -27,7 +27,7 @@ spec: {{- end }} containers: - name: {{ template "orangehrm.fullname" . }} - image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: {{ template "orangehrm.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} env: - name: ALLOW_EMPTY_PASSWORD diff --git a/stable/orangehrm/values.yaml b/stable/orangehrm/values.yaml index 550cf4bb1a..59ca4e7fd8 100644 --- a/stable/orangehrm/values.yaml +++ b/stable/orangehrm/values.yaml @@ -1,3 +1,9 @@ +## Global Docker image registry +## Please, note that this will override the image registry for all the images, including dependencies, configured to use the global value +## +# global: +# imageRegistry: + ## Bitnami OrangeHRM image version ## ref: https://hub.docker.com/r/bitnami/orangehrm/tags/ ## @@ -63,6 +69,8 @@ externalDatabase: ## ## MariaDB chart configuration ## +## https://github.com/helm/charts/blob/master/stable/mariadb/values.yaml +## mariadb: ## Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters enabled: true