From 9a4af1e30168c072d2ce5ce88bfa70e17b7e575a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Tue, 16 Oct 2018 09:59:45 +0200 Subject: [PATCH] [stable/redmine] Add global registry option (#8447) * [stable/redmine] Add global registry option Signed-off-by: Carlos Rodriguez Hernandez * Update deps Signed-off-by: Carlos Rodriguez Hernandez --- stable/redmine/Chart.yaml | 2 +- stable/redmine/README.md | 3 ++- stable/redmine/requirements.lock | 6 +++--- stable/redmine/templates/_helpers.tpl | 23 +++++++++++++++++++++++ stable/redmine/templates/deployment.yaml | 2 +- stable/redmine/values.yaml | 8 ++++++++ 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/stable/redmine/Chart.yaml b/stable/redmine/Chart.yaml index 5cfd555793..e286bcc6d9 100644 --- a/stable/redmine/Chart.yaml +++ b/stable/redmine/Chart.yaml @@ -1,5 +1,5 @@ name: redmine -version: 5.0.2 +version: 5.1.0 appVersion: 3.4.6 description: A flexible project management web application. keywords: diff --git a/stable/redmine/README.md b/stable/redmine/README.md index 9d75fb8e9f..f58b861d10 100644 --- a/stable/redmine/README.md +++ b/stable/redmine/README.md @@ -55,8 +55,9 @@ helm install --name my-release stable/redmine --set databaseType.mariadb=false,d The following table lists the configurable parameters of the Redmine chart and their default values. -| Parameter | Description | Default | +| Parameter | Description | Default | | --------------------------------- | ---------------------------------------- | ------------------------------------------------------- | +| `global.imageRegistry` | Global Docker image registry | `nil` | | `image.registry` | Redmine image registry | `docker.io` | | `image.repository` | Redmine image name | `bitnami/redmine` | | `image.tag` | Redmine image tag | `{VERSION}` | diff --git a/stable/redmine/requirements.lock b/stable/redmine/requirements.lock index 143e9783be..10b9c79ee7 100644 --- a/stable/redmine/requirements.lock +++ b/stable/redmine/requirements.lock @@ -1,9 +1,9 @@ dependencies: - name: mariadb repository: https://kubernetes-charts.storage.googleapis.com/ - version: 5.0.4 + version: 5.2.0 - name: postgresql repository: https://kubernetes-charts.storage.googleapis.com/ - version: 0.18.1 + version: 0.19.0 digest: sha256:bd7da903db69d89a8de155f6259a2ef20de455280360674b2955bb6515c13eee -generated: 2018-09-25T11:26:31.244834331+02:00 +generated: 2018-10-16T08:50:37.621182+02:00 diff --git a/stable/redmine/templates/_helpers.tpl b/stable/redmine/templates/_helpers.tpl index 55d4531f38..b3901dbb64 100644 --- a/stable/redmine/templates/_helpers.tpl +++ b/stable/redmine/templates/_helpers.tpl @@ -30,3 +30,26 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- define "redmine.postgresql.fullname" -}} {{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Return the proper Redmine image name +*/}} +{{- define "redmine.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/redmine/templates/deployment.yaml b/stable/redmine/templates/deployment.yaml index e8ac5171a0..b6506d4443 100644 --- a/stable/redmine/templates/deployment.yaml +++ b/stable/redmine/templates/deployment.yaml @@ -28,7 +28,7 @@ spec: {{- end }} containers: - name: {{ template "redmine.fullname" . }} - image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: {{ template "redmine.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} resources: {{ toYaml .Values.resources | indent 10 }} diff --git a/stable/redmine/values.yaml b/stable/redmine/values.yaml index 8f31ed7b5f..93a5a310c5 100644 --- a/stable/redmine/values.yaml +++ b/stable/redmine/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 Redmine image version ## ref: https://hub.docker.com/r/bitnami/redmine/tags/ ## @@ -63,6 +69,8 @@ databaseType: ## ## 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