From 59cdf7ccccc34ea68c9dd9304985e6505069cde9 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:55 +0200 Subject: [PATCH] [stable/prestashop] Add global registry option (#8448) * [stable/prestashop] Add global registry option Signed-off-by: Carlos Rodriguez Hernandez * Update deps Signed-off-by: Carlos Rodriguez Hernandez --- stable/prestashop/Chart.yaml | 2 +- stable/prestashop/README.md | 1 + stable/prestashop/requirements.lock | 4 ++-- stable/prestashop/templates/_helpers.tpl | 23 +++++++++++++++++++++ stable/prestashop/templates/deployment.yaml | 2 +- stable/prestashop/values.yaml | 8 +++++++ 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/stable/prestashop/Chart.yaml b/stable/prestashop/Chart.yaml index c65ad3932e..90562c965a 100644 --- a/stable/prestashop/Chart.yaml +++ b/stable/prestashop/Chart.yaml @@ -1,5 +1,5 @@ name: prestashop -version: 3.1.4 +version: 3.2.0 appVersion: 1.7.4-3 description: A popular open source ecommerce solution. Professional tools are easily accessible to increase online sales including instant guest checkout, abandoned diff --git a/stable/prestashop/README.md b/stable/prestashop/README.md index 82011318b0..cb0fcf0276 100644 --- a/stable/prestashop/README.md +++ b/stable/prestashop/README.md @@ -49,6 +49,7 @@ The following table lists the configurable parameters of the PrestaShop chart an | Parameter | Description | Default | |---------------------------------------|----------------------------------------------------------------------------------------------|---------------------------------------------------------| +| `global.imageRegistry` | Global Docker image registry | `nil` | | `image.registry` | PrestaShop image registry | `docker.io` | | `image.repository` | PrestaShop image name | `bitnami/prestashop` | | `image.tag` | PrestaShop image tag | `{VERSION}` | diff --git a/stable/prestashop/requirements.lock b/stable/prestashop/requirements.lock index c79564cd65..5c9654e96f 100644 --- a/stable/prestashop/requirements.lock +++ b/stable/prestashop/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: mariadb repository: https://kubernetes-charts.storage.googleapis.com/ - version: 5.0.8 + version: 5.2.0 digest: sha256:0593b73b2163fbbbae061de1aa2b8280d43f8a423a91e1c7375c0b6c86784b1c -generated: 2018-10-04T13:28:11.27444912Z +generated: 2018-10-16T08:50:26.245376+02:00 diff --git a/stable/prestashop/templates/_helpers.tpl b/stable/prestashop/templates/_helpers.tpl index 4bf8b34cb8..bad019eb2c 100644 --- a/stable/prestashop/templates/_helpers.tpl +++ b/stable/prestashop/templates/_helpers.tpl @@ -43,3 +43,26 @@ If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value {{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}} {{- default (include "prestashop.serviceIP" .) $host -}} {{- end -}} + +{{/* +Return the proper Prestashop image name +*/}} +{{- define "prestashop.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/prestashop/templates/deployment.yaml b/stable/prestashop/templates/deployment.yaml index 086ee3fa7e..b1cedf01c7 100644 --- a/stable/prestashop/templates/deployment.yaml +++ b/stable/prestashop/templates/deployment.yaml @@ -28,7 +28,7 @@ spec: {{- end }} containers: - name: {{ template "prestashop.fullname" . }} - image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: {{ template "prestashop.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} env: - name: ALLOW_EMPTY_PASSWORD diff --git a/stable/prestashop/values.yaml b/stable/prestashop/values.yaml index ff885fc069..5aaf6199ce 100644 --- a/stable/prestashop/values.yaml +++ b/stable/prestashop/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 PrestaShop image version ## ref: https://hub.docker.com/r/bitnami/prestashop/tags/ ## @@ -94,6 +100,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