From 038ad25dc185dceb0140038578e679b0b219cb1c Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 12:39:23 +0000 Subject: [PATCH 1/4] [bitnami/wildfly] Add global imagePullSecrets to overwrite any other existing one --- bitnami/wildfly/Chart.yaml | 2 +- bitnami/wildfly/README.md | 1 + bitnami/wildfly/templates/_helpers.tpl | 36 +++++++++++++++++++++++ bitnami/wildfly/templates/deployment.yaml | 7 +---- bitnami/wildfly/values.yaml | 11 ++++--- 5 files changed, 46 insertions(+), 11 deletions(-) diff --git a/bitnami/wildfly/Chart.yaml b/bitnami/wildfly/Chart.yaml index 90f93771e..273497af3 100644 --- a/bitnami/wildfly/Chart.yaml +++ b/bitnami/wildfly/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: wildfly -version: 2.1.6 +version: 2.2.0 appVersion: 15.0.1 description: Chart for Wildfly keywords: diff --git a/bitnami/wildfly/README.md b/bitnami/wildfly/README.md index a9364d144..80c477750 100644 --- a/bitnami/wildfly/README.md +++ b/bitnami/wildfly/README.md @@ -48,6 +48,7 @@ The following tables lists the configurable parameters of the WildFly 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` | WildFly image registry | `docker.io` | | `image.repository` | WildFly Image name | `bitnami/wildfly` | | `image.tag` | WildFly Image tag | `{VERSION}` | diff --git a/bitnami/wildfly/templates/_helpers.tpl b/bitnami/wildfly/templates/_helpers.tpl index 3d8fd4ded..75bd0cb64 100644 --- a/bitnami/wildfly/templates/_helpers.tpl +++ b/bitnami/wildfly/templates/_helpers.tpl @@ -37,3 +37,39 @@ Also, we can't use a single if because lazy evaluation is not an option {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} {{- end -}} {{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "wildfly.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 -}} \ No newline at end of file diff --git a/bitnami/wildfly/templates/deployment.yaml b/bitnami/wildfly/templates/deployment.yaml index 57292e9fe..5827db4c8 100644 --- a/bitnami/wildfly/templates/deployment.yaml +++ b/bitnami/wildfly/templates/deployment.yaml @@ -24,12 +24,7 @@ spec: fsGroup: {{ .Values.securityContext.fsGroup }} runAsUser: {{ .Values.securityContext.runAsUser }} {{- end }} - {{- if .Values.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.image.pullSecrets }} - - name: {{ . }} - {{- end }} - {{- end }} +{{- include "wildfly.imagePullSecrets" . | indent 6 }} containers: - name: {{ template "fullname" . }} image: "{{ template "wildfly.image" . }}" diff --git a/bitnami/wildfly/values.yaml b/bitnami/wildfly/values.yaml index 10314314d..112b454c9 100644 --- a/bitnami/wildfly/values.yaml +++ b/bitnami/wildfly/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 WildFly image version ## ref: https://hub.docker.com/r/bitnami/wildfly/tags/ @@ -21,7 +24,7 @@ image: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## Specify a imagePullPolicy ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images From 67d7640e0b49338c840a11377b942e932e6e5ced Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 15:19:19 +0000 Subject: [PATCH 2/4] Fix typo --- bitnami/wildfly/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/wildfly/values.yaml b/bitnami/wildfly/values.yaml index 112b454c9..337fd1b45 100644 --- a/bitnami/wildfly/values.yaml +++ b/bitnami/wildfly/values.yaml @@ -1,6 +1,6 @@ ## 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 +## Current available global Docker image parameters: imageRegistry and imagePullSecrets ## # global: # imageRegistry: myRegistryName From 1f98ff226ea155f730c3ec41df6e656cfa4e7596 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 18:05:28 +0000 Subject: [PATCH 3/4] Remove unnecessary metrics conditions --- bitnami/wildfly/templates/_helpers.tpl | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bitnami/wildfly/templates/_helpers.tpl b/bitnami/wildfly/templates/_helpers.tpl index 75bd0cb64..ec3d9b032 100644 --- a/bitnami/wildfly/templates/_helpers.tpl +++ b/bitnami/wildfly/templates/_helpers.tpl @@ -54,22 +54,16 @@ imagePullSecrets: .Values.global.imagePullSecrets }} - name: {{ . }} {{- end }} -{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} +{{- else if .Values.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 }} +{{- else if .Values.image.pullSecrets }} imagePullSecrets: {{- range .Values.image.pullSecrets }} - name: {{ . }} {{- end }} -{{- range .Values.metrics.image.pullSecrets }} - - name: {{ . }} -{{- end }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} From 55b68c025a8fb4a57a132b5b4b1c0011cc1575b7 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 18:52:30 +0000 Subject: [PATCH 4/4] Fix typo in helpers Signed-off-by: Carlos Rodriguez Hernandez --- bitnami/wildfly/templates/_helpers.tpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bitnami/wildfly/templates/_helpers.tpl b/bitnami/wildfly/templates/_helpers.tpl index ec3d9b032..7b1456e95 100644 --- a/bitnami/wildfly/templates/_helpers.tpl +++ b/bitnami/wildfly/templates/_helpers.tpl @@ -50,8 +50,7 @@ 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 }} +{{- range .Values.global.imagePullSecrets }} - name: {{ . }} {{- end }} {{- else if .Values.image.pullSecrets }}