From 5251b4d50ea55c5f0a2fbc60206785bf80775bac Mon Sep 17 00:00:00 2001 From: tikhon-opsfleet <112847337+tikhon-opsfleet@users.noreply.github.com> Date: Wed, 23 Aug 2023 14:01:41 +0600 Subject: [PATCH] [helm] add possibility to use array for imagePullSecrets (#4782) add possibility to use array for imagePullSecrets --- k8s/charts/seaweedfs/templates/_helpers.tpl | 17 ++++++++++++++++- .../seaweedfs/templates/filer-statefulset.yaml | 5 +---- .../seaweedfs/templates/master-statefulset.yaml | 5 +---- .../seaweedfs/templates/s3-deployment.yaml | 5 +---- .../seaweedfs/templates/volume-statefulset.yaml | 5 +---- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/k8s/charts/seaweedfs/templates/_helpers.tpl b/k8s/charts/seaweedfs/templates/_helpers.tpl index b8048abb6..712657474 100644 --- a/k8s/charts/seaweedfs/templates/_helpers.tpl +++ b/k8s/charts/seaweedfs/templates/_helpers.tpl @@ -182,4 +182,19 @@ Inject extra environment vars in the format key:value, if populated {{- else -}} {{- printf "false" -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* Return the proper imagePullSecrets */}} +{{- define "seaweedfs.imagePullSecrets" -}} +{{- if .Values.global.imagePullSecrets }} +{{- if kindIs "string" .Values.global.imagePullSecrets }} +imagePullSecrets: + - name: {{ .Values.global.imagePullSecrets }} +{{- else }} +imagePullSecrets: +{{- range .Values.global.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- end }} +{{- end }} +{{- end -}} diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml index b770025a1..7a2810a71 100644 --- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml @@ -42,10 +42,7 @@ spec: tolerations: {{ tpl .Values.filer.tolerations . | nindent 8 | trim }} {{- end }} - {{- if .Values.global.imagePullSecrets }} - imagePullSecrets: - - name: {{ .Values.global.imagePullSecrets }} - {{- end }} + {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }} {{- if .Values.global.createClusterRole }} serviceAccountName: seaweedfs-rw-sa #hack for delete pod master after migration {{- end }} diff --git a/k8s/charts/seaweedfs/templates/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master-statefulset.yaml index 7a01eff85..e1b272ab4 100644 --- a/k8s/charts/seaweedfs/templates/master-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/master-statefulset.yaml @@ -42,10 +42,7 @@ spec: tolerations: {{ tpl .Values.master.tolerations . | nindent 8 | trim }} {{- end }} - {{- if .Values.global.imagePullSecrets }} - imagePullSecrets: - - name: {{ .Values.global.imagePullSecrets }} - {{- end }} + {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }} terminationGracePeriodSeconds: 60 {{- if .Values.master.priorityClassName }} priorityClassName: {{ .Values.master.priorityClassName | quote }} diff --git a/k8s/charts/seaweedfs/templates/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3-deployment.yaml index 8565b6c81..d0d56d0ef 100644 --- a/k8s/charts/seaweedfs/templates/s3-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/s3-deployment.yaml @@ -30,10 +30,7 @@ spec: tolerations: {{ tpl .Values.s3.tolerations . | nindent 8 | trim }} {{- end }} - {{- if .Values.global.imagePullSecrets }} - imagePullSecrets: - - name: {{ .Values.global.imagePullSecrets }} - {{- end }} + {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }} terminationGracePeriodSeconds: 10 {{- if .Values.s3.priorityClassName }} priorityClassName: {{ .Values.s3.priorityClassName | quote }} diff --git a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml index 4c4681618..4abadb24d 100644 --- a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml @@ -36,10 +36,7 @@ spec: tolerations: {{ tpl .Values.volume.tolerations . | nindent 8 | trim }} {{- end }} - {{- if .Values.global.imagePullSecrets }} - imagePullSecrets: - - name: {{ .Values.global.imagePullSecrets }} - {{- end }} + {{- include "seaweedfs.imagePullSecrets" . | nindent 6 }} terminationGracePeriodSeconds: 150 {{- if .Values.volume.priorityClassName }} priorityClassName: {{ .Values.volume.priorityClassName | quote }}