[bitnami/metrics-server] Add global imagePullSecrets to overwrite any other existing one

This commit is contained in:
Carlos Rodriguez Hernandez
2019-03-11 12:59:20 +00:00
parent f58ea6fcc3
commit b03896b656
5 changed files with 45 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: metrics-server
version: 2.2.2
version: 2.3.0
appVersion: 0.3.1
description: Metrics Server is a cluster-wide aggregator of resource usage data. Metrics Server collects metrics from the Summary API, exposed by Kubelet on each node.
keywords:
+1
View File
@@ -48,6 +48,7 @@ The following tables lists the configurable parameters of the Metrics Server cha
| 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` | Metrics Server image registry | `docker.io` |
| `image.repository` | Metrics Server image name | `bitnami/metrics-server` |
| `image.tag` | Metrics Server image tag | `{VERSION}` |
@@ -56,3 +56,39 @@ Also, we can't use a single if because lazy evaluation is not an option
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "metrics-server.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 -}}
@@ -25,6 +25,7 @@ spec:
chart: {{ template "metrics-server.chart" . }}
spec:
serviceAccountName: {{ template "metrics-server.serviceAccountName" . }}
{{- include "metrics-server.imagePullSecrets" . | indent 6 }}
containers:
- name: metrics-server
image: {{ template "metrics-server.image" . }}
@@ -35,4 +36,3 @@ spec:
command:
- metrics-server
- --secure-port={{ .Values.securePort }}
+6 -3
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 Metrics Server image version
## ref: https://hub.docker.com/r/bitnami/metrics-server/tags/