[bitnami/jenkins] Add global imagePullSecrets to overwrite any other existing one

This commit is contained in:
Carlos Rodriguez Hernandez
2019-03-11 12:36:44 +00:00
parent f58ea6fcc3
commit 43e536b32e
5 changed files with 47 additions and 12 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: jenkins
version: 2.1.7
version: 2.2.0
appVersion: 2.150.3
description: The leading open source automation server
keywords:
+1
View File
@@ -48,6 +48,7 @@ The following tables lists the configurable parameters of the Jenkins 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` | Jenkins image registry | `docker.io` |
| `image.repository` | Jenkins Image name | `bitnami/jenkins` |
| `image.tag` | Jenkins Image tag | `{VERSION}` |
+36
View File
@@ -47,3 +47,39 @@ Return the proper image name (for the metrics image)
{{- $tag := .Values.metrics.image.tag | toString -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "jenkins.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 -}}
+1 -6
View File
@@ -28,12 +28,7 @@ spec:
{{- end }}
{{- end }}
spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end }}
{{- include "jenkins.imagePullSecrets" . | indent 6 }}
containers:
- name: jenkins
image: "{{ template "jenkins.image" . }}"
+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 Jenkins image version
## ref: https://hub.docker.com/r/bitnami/jenkins/tags/
@@ -21,7 +24,7 @@ image:
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistrKeySecretName
# - myRegistryKeySecretName
## User of the application
## ref: https://github.com/bitnami/bitnami-docker-jenkins#configuration
@@ -106,7 +109,7 @@ metrics:
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistrKeySecretName
# - myRegistryKeySecretName
## Metrics exporter pod Annotation and Labels
podAnnotations:
prometheus.io/scrape: "true"