From 1a3af293a87d56e4169530c812dd173da94ab947 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 12:35:47 +0000 Subject: [PATCH 1/3] [bitnami/elasticsearch] Add global imagePullSecrets to overwrite any other existing one --- bitnami/elasticsearch/Chart.yaml | 2 +- bitnami/elasticsearch/README.md | 1 + bitnami/elasticsearch/templates/_helpers.tpl | 36 +++++++++++++++++++ .../templates/coordinating-deploy.yaml | 7 +--- .../templates/ingest-deploy.yaml | 7 +--- .../templates/master-deploy.yaml | 7 +--- .../templates/metrics-deploy.yaml | 9 ++--- bitnami/elasticsearch/values.yaml | 13 ++++--- 8 files changed, 51 insertions(+), 31 deletions(-) diff --git a/bitnami/elasticsearch/Chart.yaml b/bitnami/elasticsearch/Chart.yaml index 0da47b26d4..07a7bf4136 100644 --- a/bitnami/elasticsearch/Chart.yaml +++ b/bitnami/elasticsearch/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: elasticsearch -version: 4.3.0 +version: 4.4.0 appVersion: 6.6.1 description: A highly scalable open-source full-text search and analytics engine keywords: diff --git a/bitnami/elasticsearch/README.md b/bitnami/elasticsearch/README.md index ff00fc8853..a71183555c 100644 --- a/bitnami/elasticsearch/README.md +++ b/bitnami/elasticsearch/README.md @@ -52,6 +52,7 @@ The following table lists the configurable parameters of the Elasticsearch chart | 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` | Elasticsearch image registry | `docker.io` | | `image.repository` | Elasticsearch image repository | `bitnami/elasticsearch` | | `image.tag` | Elasticsearch image tag | `{VERSION}` | diff --git a/bitnami/elasticsearch/templates/_helpers.tpl b/bitnami/elasticsearch/templates/_helpers.tpl index 46cad9df98..8d60667eca 100644 --- a/bitnami/elasticsearch/templates/_helpers.tpl +++ b/bitnami/elasticsearch/templates/_helpers.tpl @@ -116,3 +116,39 @@ Return the proper sysctl image name {{- $tag := default "latest" .Values.sysctlImage.tag | toString -}} {{- printf "%s/%s:%s" $registryName .Values.sysctlImage.repository $tag -}} {{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "elasticsearch.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/elasticsearch/templates/coordinating-deploy.yaml b/bitnami/elasticsearch/templates/coordinating-deploy.yaml index 89e9671f55..00637a3f1d 100644 --- a/bitnami/elasticsearch/templates/coordinating-deploy.yaml +++ b/bitnami/elasticsearch/templates/coordinating-deploy.yaml @@ -51,12 +51,7 @@ spec: {{- if .Values.coordinating.nodeAffinity }} {{ toYaml .Values.coordinating.nodeAffinity | indent 8 }} {{- end }} - {{- if .Values.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.image.pullSecrets }} - - name: {{ . }} - {{- end}} - {{- end }} +{{- include "elasticsearch.imagePullSecrets" . | indent 6 }} {{- if .Values.sysctlImage.enabled }} ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors) initContainers: diff --git a/bitnami/elasticsearch/templates/ingest-deploy.yaml b/bitnami/elasticsearch/templates/ingest-deploy.yaml index e16b7af5ed..9d8819070b 100644 --- a/bitnami/elasticsearch/templates/ingest-deploy.yaml +++ b/bitnami/elasticsearch/templates/ingest-deploy.yaml @@ -52,12 +52,7 @@ spec: {{- if .Values.ingest.nodeAffinity }} {{ toYaml .Values.ingest.nodeAffinity | indent 8 }} {{- end }} - {{- if .Values.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.image.pullSecrets }} - - name: {{ . }} - {{- end}} - {{- end }} +{{- include "elasticsearch.imagePullSecrets" . | indent 6 }} {{- if .Values.sysctlImage.enabled }} ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors) initContainers: diff --git a/bitnami/elasticsearch/templates/master-deploy.yaml b/bitnami/elasticsearch/templates/master-deploy.yaml index a43dceae99..56133ddbd8 100644 --- a/bitnami/elasticsearch/templates/master-deploy.yaml +++ b/bitnami/elasticsearch/templates/master-deploy.yaml @@ -52,12 +52,7 @@ spec: {{- if .Values.master.nodeAffinity }} {{ toYaml .Values.master.nodeAffinity | indent 8 }} {{- end }} - {{- if .Values.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.image.pullSecrets }} - - name: {{ . }} - {{- end}} - {{- end }} +{{- include "elasticsearch.imagePullSecrets" . | indent 6 }} {{- if .Values.sysctlImage.enabled }} ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors) initContainers: diff --git a/bitnami/elasticsearch/templates/metrics-deploy.yaml b/bitnami/elasticsearch/templates/metrics-deploy.yaml index f1349713ee..2f8926415e 100644 --- a/bitnami/elasticsearch/templates/metrics-deploy.yaml +++ b/bitnami/elasticsearch/templates/metrics-deploy.yaml @@ -14,7 +14,7 @@ spec: matchLabels: app: {{ template "elasticsearch.name" . }} release: "{{ .Release.Name }}" - role: "metrics" + role: "metrics" replicas: 1 template: metadata: @@ -24,12 +24,7 @@ spec: chart: {{ template "elasticsearch.chart" . }} role: "metrics" spec: - {{- if .Values.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.image.pullSecrets }} - - name: {{ . }} - {{- end}} - {{- end }} +{{- include "elasticsearch.imagePullSecrets" . | indent 6 }} containers: - name: {{ template "elasticsearch.metrics.fullname" . }} image: {{ template "metrics.image" . }} diff --git a/bitnami/elasticsearch/values.yaml b/bitnami/elasticsearch/values.yaml index cb96b3ac73..8c92b12665 100644 --- a/bitnami/elasticsearch/values.yaml +++ b/bitnami/elasticsearch/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 Elasticsearch image version ## ref: https://hub.docker.com/r/bitnami/elasticsearch/tags/ @@ -21,7 +24,7 @@ image: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## Image that performs the sysctl operation ## @@ -40,7 +43,7 @@ sysctlImage: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## Elasticsearch cluster name ## From 984e349ede0003f5b839f06b76b4e0bb9082107e Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 15:18:36 +0000 Subject: [PATCH 2/3] Fix typo --- bitnami/elasticsearch/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/elasticsearch/values.yaml b/bitnami/elasticsearch/values.yaml index 8c92b12665..8d0cbbcfda 100644 --- a/bitnami/elasticsearch/values.yaml +++ b/bitnami/elasticsearch/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 5261a1fa7833e0d4ab4cb42ce4d0a5c8f42d5a03 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Mon, 11 Mar 2019 18:50:05 +0000 Subject: [PATCH 3/3] Fix typo in helpers Signed-off-by: Carlos Rodriguez Hernandez --- bitnami/elasticsearch/templates/_helpers.tpl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bitnami/elasticsearch/templates/_helpers.tpl b/bitnami/elasticsearch/templates/_helpers.tpl index 8d60667eca..ee9f425553 100644 --- a/bitnami/elasticsearch/templates/_helpers.tpl +++ b/bitnami/elasticsearch/templates/_helpers.tpl @@ -129,8 +129,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 or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }} @@ -151,4 +150,4 @@ imagePullSecrets: - name: {{ . }} {{- end }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}}