From 22b6484babdfffa2f34f6ec1ca2ff87c905aa9d4 Mon Sep 17 00:00:00 2001 From: Jonas R Date: Mon, 20 Jul 2020 18:08:51 +0200 Subject: [PATCH] [stable/minio] Support imagePullSecrets for StatefulSet. (#23042) * [stable/minio] Support imagePullSecrets for StatefulSet. Signed-off-by: Jonas Rabouli * [stable/minio] Added imagePullSecrets template Signed-off-by: Jonas Rabouli * [stable/minio] Bumped version Signed-off-by: Jonas Rabouli --- stable/minio/Chart.yaml | 2 +- stable/minio/templates/_helpers.tpl | 25 +++++++++++++++++++ stable/minio/templates/deployment.yaml | 4 +-- .../post-install-create-bucket-job.yaml | 1 + .../post-install-prometheus-metrics-job.yaml | 1 + stable/minio/templates/statefulset.yaml | 1 + 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/stable/minio/Chart.yaml b/stable/minio/Chart.yaml index ac2c5ae80f..bc97723ca2 100755 --- a/stable/minio/Chart.yaml +++ b/stable/minio/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: MinIO is a high performance data infrastructure for machine learning, analytics and application data workloads. name: minio -version: 5.0.31 +version: 5.0.32 appVersion: master keywords: - storage diff --git a/stable/minio/templates/_helpers.tpl b/stable/minio/templates/_helpers.tpl index ef929d39b6..30749a10ea 100644 --- a/stable/minio/templates/_helpers.tpl +++ b/stable/minio/templates/_helpers.tpl @@ -94,3 +94,28 @@ Properly format optional additional arguments to Minio binary {{ " " }}{{ . }} {{- end -}} {{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "minio.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 .Values.imagePullSecrets }} +imagePullSecrets: + {{ toYaml .Values.imagePullSecrets }} +{{- end -}} +{{- else if .Values.imagePullSecrets }} +imagePullSecrets: + {{ toYaml .Values.imagePullSecrets }} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/minio/templates/deployment.yaml b/stable/minio/templates/deployment.yaml index a71fb7fccb..dfd09208d6 100644 --- a/stable/minio/templates/deployment.yaml +++ b/stable/minio/templates/deployment.yaml @@ -227,9 +227,7 @@ spec: nodeSelector: {{ toYaml . | indent 8 }} {{- end }} -{{- if .Values.imagePullSecrets }} - imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }} -{{- end }} +{{- include "minio.imagePullSecrets" . | indent 6 }} {{- with .Values.affinity }} affinity: {{ toYaml . | indent 8 }} diff --git a/stable/minio/templates/post-install-create-bucket-job.yaml b/stable/minio/templates/post-install-create-bucket-job.yaml index 9a7fbb7fac..06a4d8e247 100755 --- a/stable/minio/templates/post-install-create-bucket-job.yaml +++ b/stable/minio/templates/post-install-create-bucket-job.yaml @@ -25,6 +25,7 @@ spec: {{- end }} spec: restartPolicy: OnFailure +{{- include "minio.imagePullSecrets" . | indent 6 }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} diff --git a/stable/minio/templates/post-install-prometheus-metrics-job.yaml b/stable/minio/templates/post-install-prometheus-metrics-job.yaml index 3f4d8ceb3c..20ef89fd03 100644 --- a/stable/minio/templates/post-install-prometheus-metrics-job.yaml +++ b/stable/minio/templates/post-install-prometheus-metrics-job.yaml @@ -28,6 +28,7 @@ spec: serviceAccountName: {{ $fullName }}-update-prometheus-secret {{- end }} restartPolicy: OnFailure +{{- include "minio.imagePullSecrets" . | indent 6 }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} diff --git a/stable/minio/templates/statefulset.yaml b/stable/minio/templates/statefulset.yaml index 1ae5fc9e79..d893bc7e74 100644 --- a/stable/minio/templates/statefulset.yaml +++ b/stable/minio/templates/statefulset.yaml @@ -176,6 +176,7 @@ spec: nodeSelector: {{ toYaml . | indent 8 }} {{- end }} +{{- include "minio.imagePullSecrets" . | indent 6 }} {{- with .Values.affinity }} affinity: {{ toYaml . | indent 8 }}