diff --git a/stable/nats/Chart.yaml b/stable/nats/Chart.yaml index 1c68b4bfd1..d29d400ec1 100644 --- a/stable/nats/Chart.yaml +++ b/stable/nats/Chart.yaml @@ -1,5 +1,5 @@ name: nats -version: 1.0.3 +version: 1.1.0 appVersion: 1.3.0 description: An open-source, cloud-native messaging system keywords: diff --git a/stable/nats/README.md b/stable/nats/README.md index 4a592c847c..cdfadead1b 100644 --- a/stable/nats/README.md +++ b/stable/nats/README.md @@ -47,6 +47,7 @@ The following table lists the configurable parameters of the NATS chart and thei | Parameter | Description | Default | |--------------------------------------|----------------------------------------------------------------------------------------------|-----------------------------------| +| `global.imageRegistry` | Global Docker image registry | `nil` | | `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 32e67f4151..26300acf19 100644 --- a/stable/nats/templates/_helpers.tpl +++ b/stable/nats/templates/_helpers.tpl @@ -21,11 +21,26 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- end -}} {{/* -Return the proper image name +Return the proper Nats image name */}} {{- define "nats.image" -}} +{{- $registryName := .Values.image.registry -}} +{{- $repositoryName := .Values.image.repository -}} {{- $tag := .Values.image.tag | toString -}} -{{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository $tag -}} +{{/* +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/nats/values-production.yaml b/stable/nats/values-production.yaml index e671538962..67fec7a492 100644 --- a/stable/nats/values-production.yaml +++ b/stable/nats/values-production.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 NATS image version ## ref: https://hub.docker.com/r/bitnami/nats/tags/ ## diff --git a/stable/nats/values.yaml b/stable/nats/values.yaml index d233e78d52..4bff1671f0 100644 --- a/stable/nats/values.yaml +++ b/stable/nats/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 NATS image version ## ref: https://hub.docker.com/r/bitnami/nats/tags/ ##