From 98f2dcdec38107c7d47c571b27d7214e7fa00b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Tue, 16 Oct 2018 10:44:49 +0200 Subject: [PATCH] [stable/phpbb] Add global registry option (#8452) * [stable/phpbb] Add global registry option Signed-off-by: Carlos Rodriguez Hernandez * Update deps Signed-off-by: Carlos Rodriguez Hernandez --- stable/phpbb/Chart.yaml | 2 +- stable/phpbb/README.md | 1 + stable/phpbb/requirements.lock | 4 ++-- stable/phpbb/templates/_helpers.tpl | 23 +++++++++++++++++++++++ stable/phpbb/templates/deployment.yaml | 2 +- stable/phpbb/values.yaml | 8 ++++++++ 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/stable/phpbb/Chart.yaml b/stable/phpbb/Chart.yaml index 34519a3110..5c904ef964 100644 --- a/stable/phpbb/Chart.yaml +++ b/stable/phpbb/Chart.yaml @@ -1,5 +1,5 @@ name: phpbb -version: 3.0.3 +version: 3.1.0 appVersion: 3.2.3 description: Community forum that supports the notion of users and groups, file attachments, full-text search, notifications and more. diff --git a/stable/phpbb/README.md b/stable/phpbb/README.md index a971c089d8..a8e22f46d7 100644 --- a/stable/phpbb/README.md +++ b/stable/phpbb/README.md @@ -49,6 +49,7 @@ The following table lists the configurable parameters of the phpBB chart and the | Parameter | Description | Default | |-----------------------------------|---------------------------------------|---------------------------------------------------------| +| `global.imageRegistry` | Global Docker image registry | `nil` | | `image.registry` | phpBB image registry | `docker.io` | | `image.repository` | phpBB image name | `bitnami/phpbb` | | `image.tag` | phpBB image tag | `{VERSION}` | diff --git a/stable/phpbb/requirements.lock b/stable/phpbb/requirements.lock index adc8b11acd..4a8ecdbf77 100644 --- a/stable/phpbb/requirements.lock +++ b/stable/phpbb/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:54:08.872296213+02:00 +generated: 2018-10-16T08:50:16.14675+02:00 diff --git a/stable/phpbb/templates/_helpers.tpl b/stable/phpbb/templates/_helpers.tpl index ba3f292293..aa192d1a09 100644 --- a/stable/phpbb/templates/_helpers.tpl +++ b/stable/phpbb/templates/_helpers.tpl @@ -22,3 +22,26 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- define "phpbb.mariadb.fullname" -}} {{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Return the proper phpbb image name +*/}} +{{- define "phpbb.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/phpbb/templates/deployment.yaml b/stable/phpbb/templates/deployment.yaml index da9d4999eb..8bf347b049 100644 --- a/stable/phpbb/templates/deployment.yaml +++ b/stable/phpbb/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: {{- end }} containers: - name: {{ template "phpbb.fullname" . }} - image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: {{ template "phpbb.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} env: - name: ALLOW_EMPTY_PASSWORD diff --git a/stable/phpbb/values.yaml b/stable/phpbb/values.yaml index d364a8b0c5..6145a7a81f 100644 --- a/stable/phpbb/values.yaml +++ b/stable/phpbb/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 phpBB image version ## ref: https://hub.docker.com/r/bitnami/phpbb/tags/ ## @@ -67,6 +73,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