diff --git a/stable/nats/Chart.yaml b/stable/nats/Chart.yaml index 97f0d33da0..4256b9edbf 100644 --- a/stable/nats/Chart.yaml +++ b/stable/nats/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: nats -version: 2.0.6 +version: 2.1.0 appVersion: 1.4.1 description: An open-source, cloud-native messaging system keywords: diff --git a/stable/nats/README.md b/stable/nats/README.md index a0b89b5e25..5da52959f6 100644 --- a/stable/nats/README.md +++ b/stable/nats/README.md @@ -48,6 +48,7 @@ The following table lists the configurable parameters of the NATS chart and thei | 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` | NATS image registry | `docker.io` | | `image.repository` | NATS Image name | `bitnami/nats` | | `image.tag` | NATS Image tag | `{VERSION}` | diff --git a/stable/nats/templates/_helpers.tpl b/stable/nats/templates/_helpers.tpl index 2609856746..adffe94f68 100644 --- a/stable/nats/templates/_helpers.tpl +++ b/stable/nats/templates/_helpers.tpl @@ -79,3 +79,38 @@ Return the proper image name (for the metrics image) {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} {{- end -}} {{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "nats.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/nats/templates/statefulset.yaml b/stable/nats/templates/statefulset.yaml index 7c8a20f399..685691bc07 100644 --- a/stable/nats/templates/statefulset.yaml +++ b/stable/nats/templates/statefulset.yaml @@ -39,10 +39,7 @@ spec: {{- end }} {{- end }} spec: - {{- if .Values.image.pullSecrets }} - imagePullSecrets: -{{ toYaml .Values.image.pullSecrets | indent 8 }} - {{- end }} +{{- include "nats.imagePullSecrets" . | indent 6 }} {{- if .Values.securityContext.enabled }} securityContext: fsGroup: {{ .Values.securityContext.fsGroup }} diff --git a/stable/nats/values.yaml b/stable/nats/values.yaml index 2d72bd2ac0..2e30c02a9f 100644 --- a/stable/nats/values.yaml +++ b/stable/nats/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 NATS image version ## ref: https://hub.docker.com/r/bitnami/nats/tags/ @@ -21,7 +24,7 @@ image: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - name: myRegistrKeySecretName + # - name: myRegistryKeySecretName ## NATS replicas replicaCount: 1 @@ -273,7 +276,7 @@ metrics: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: - # - myRegistrKeySecretName + # - myRegistryKeySecretName ## Metrics exporter resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ##