[stable/redis] Add global 'imagePullSecrets' to overwrite any other existing one (#12068)

* [stable/redis] Add global 'imagePullSecrets' to overwrite any other existing one

Signed-off-by: Carlos Rodriguez Hernandez <crhernandez@bitnami.com>

* Fix typo and add var to the README

Signed-off-by: Carlos Rodriguez Hernandez <crhernandez@bitnami.com>

* Fix typo in helpers

Signed-off-by: Carlos Rodriguez Hernandez <crhernandez@bitnami.com>
This commit is contained in:
Carlos Rodríguez Hernández
2019-03-12 03:54:51 -07:00
committed by Kubernetes Prow Robot
parent ab6b9aaf0c
commit 412e33c308
7 changed files with 48 additions and 24 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: redis
version: 6.1.4
version: 6.2.0
appVersion: 4.0.13
description: Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
keywords:
+1
View File
@@ -90,6 +90,7 @@ The following table lists the configurable parameters of the Redis chart and the
| 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` | Redis Image registry | `docker.io` |
| `image.repository` | Redis Image name | `bitnami/redis` |
| `image.tag` | Redis Image tag | `{VERSION}` |
+35
View File
@@ -173,3 +173,38 @@ Return sysctl image
{{- $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 "redis.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 -}}
@@ -30,12 +30,7 @@ spec:
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.metrics.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.metrics.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end }}
{{- include "redis.imagePullSecrets" . | indent 6 }}
{{- if .Values.metrics.nodeSelector }}
nodeSelector:
{{ toYaml .Values.metrics.nodeSelector | indent 8 }}
@@ -32,12 +32,7 @@ spec:
{{ toYaml .Values.master.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- include "redis.imagePullSecrets" . | indent 6 }}
{{- if .Values.master.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.master.securityContext.fsGroup }}
@@ -39,12 +39,7 @@ spec:
{{ toYaml (.Values.slave.podAnnotations | default .Values.master.podAnnotations) | indent 8 }}
{{- end }}
spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- include "redis.imagePullSecrets" . | indent 6 }}
{{- /* Include master securityContext.fsGroup if slave securityContext.fsGroup not defined */ -}}
{{- if (.Values.slave.securityContext | default .Values.master.securityContext) }}
securityContext:
+8 -5
View File
@@ -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 Redis image version
## ref: https://hub.docker.com/r/bitnami/redis/tags/
@@ -24,7 +27,7 @@ image:
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistrKeySecretName
# - myRegistryKeySecretName
## Cluster settings
cluster:
@@ -315,7 +318,7 @@ metrics:
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistrKeySecretName
# - myRegistryKeySecretName
service:
type: ClusterIP