From 8a25f1d9271f37aeb31eaeccf7652f312f4a8463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Tue, 12 Mar 2019 10:19:15 +0100 Subject: [PATCH] [stable/dokuwiki] Add global 'imagePullSecrets' to overwrite any other existing one (#12096) * [stable/dokuwiki] Add global 'imagePullSecrets' to overwrite any other existing one Signed-off-by: Carlos Rodriguez Hernandez * Fix typo and add var to the README Signed-off-by: Carlos Rodriguez Hernandez * Fix typo in helpers Signed-off-by: Carlos Rodriguez Hernandez --- stable/dokuwiki/Chart.yaml | 2 +- stable/dokuwiki/README.md | 1 + stable/dokuwiki/templates/_helpers.tpl | 35 +++++++++++++++++++++++ stable/dokuwiki/templates/deployment.yaml | 7 +---- stable/dokuwiki/values.yaml | 13 +++++---- 5 files changed, 46 insertions(+), 12 deletions(-) diff --git a/stable/dokuwiki/Chart.yaml b/stable/dokuwiki/Chart.yaml index 52f43be95f..f926e4092f 100644 --- a/stable/dokuwiki/Chart.yaml +++ b/stable/dokuwiki/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: dokuwiki -version: 4.0.2 +version: 4.1.0 appVersion: 0.20180422.201805030840 description: DokuWiki is a standards-compliant, simple to use wiki optimized for creating documentation. It is targeted at developer teams, workgroups, and small companies. diff --git a/stable/dokuwiki/README.md b/stable/dokuwiki/README.md index 0a3d6c83fc..e4c90eec44 100644 --- a/stable/dokuwiki/README.md +++ b/stable/dokuwiki/README.md @@ -48,6 +48,7 @@ The following table lists the configurable parameters of the DokuWiki chart and | Parameter | Description | Default | |--------------------------------------|------------------------------------------------------------|-----------------------------------------------| | `global.imageRegistry` | Global Docker image registry | `nil` | +| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | `image.registry` | DokuWiki image registry | `docker.io` | | `image.repository` | DokuWiki image name | `bitnami/dokuwiki` | | `image.tag` | DokuWiki image tag | `{VERSION}` | diff --git a/stable/dokuwiki/templates/_helpers.tpl b/stable/dokuwiki/templates/_helpers.tpl index 1ad62fbe8a..38f3f2bfaf 100644 --- a/stable/dokuwiki/templates/_helpers.tpl +++ b/stable/dokuwiki/templates/_helpers.tpl @@ -54,3 +54,38 @@ Return the proper image name (for the metrics image) {{- $tag := .Values.metrics.image.tag | toString -}} {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} {{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "dokuwiki.imagePullSecrets" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +Also, we can not use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} +{{- if .Values.global.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.global.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.metrics.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.metrics.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- end -}} diff --git a/stable/dokuwiki/templates/deployment.yaml b/stable/dokuwiki/templates/deployment.yaml index 20fbe7f340..66d3210cba 100644 --- a/stable/dokuwiki/templates/deployment.yaml +++ b/stable/dokuwiki/templates/deployment.yaml @@ -40,12 +40,7 @@ spec: tolerations: {{ toYaml .Values.tolerations | indent 8 }} {{- end }} - {{- if .Values.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.image.pullSecrets }} - - name: {{ . }} - {{- end}} - {{- end }} +{{- include "dokuwiki.imagePullSecrets" . | indent 6 }} hostAliases: - ip: "127.0.0.1" hostnames: diff --git a/stable/dokuwiki/values.yaml b/stable/dokuwiki/values.yaml index c1ce46d56c..3941f7ce86 100644 --- a/stable/dokuwiki/values.yaml +++ b/stable/dokuwiki/values.yaml @@ -1,8 +1,11 @@ -## 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 Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets ## # global: -# imageRegistry: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName ## Bitnami DokuWiki image version ## ref: https://hub.docker.com/r/bitnami/dokuwiki/tags/ @@ -21,7 +24,7 @@ image: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## User of the application ## ref: https://github.com/bitnami/bitnami-docker-dokuwiki#environment-variables @@ -199,7 +202,7 @@ metrics: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## Metrics exporter pod Annotation and Labels podAnnotations: prometheus.io/scrape: "true"