render imagePullSecrets in Deployment/StatefulSet (#1130)

Signed-off-by: czaloumis <80974398+czaloumis@users.noreply.github.com>
This commit is contained in:
czaloumis
2025-12-13 05:23:35 +02:00
committed by GitHub
parent 08be8f5472
commit 1229fddb5d
6 changed files with 47 additions and 8 deletions
+19
View File
@@ -80,3 +80,22 @@ Return image pull secret content
{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }}
{{- end }}
{{- end }}
{{/*
Return the default imagePullSecret name
*/}}
{{- define "rustfs.imagePullSecret.name" -}}
{{- printf "%s-registry-secret" (include "rustfs.fullname" .) }}
{{- end }}
{{/*
Render imagePullSecrets for workloads - appends registry secret
*/}}
{{- define "chart.imagePullSecrets" -}}
{{- $secrets := .Values.imagePullSecrets | default list }}
{{- if .Values.imageRegistryCredentials.enabled }}
{{- $secrets = append $secrets (dict "name" (include "rustfs.imagePullSecret.name" .)) }}
{{- end }}
{{- toYaml $secrets }}
{{- end }}
+2 -2
View File
@@ -15,9 +15,9 @@ spec:
labels:
app: {{ include "rustfs.name" . }}
spec:
{{- if .Values.imageRegistryCredentials.enabled }}
{{- with include "chart.imagePullSecrets" . }}
imagePullSecrets:
- name: {{ .Values.imagePullSecrets }}
{{- . | nindent 8 }}
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
+1 -1
View File
@@ -14,7 +14,7 @@ data:
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.imagePullSecrets }}
name: {{ include "rustfs.imagePullSecret.name" . }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "imagePullSecret" . }}
+2 -2
View File
@@ -15,9 +15,9 @@ spec:
labels:
app: {{ include "rustfs.name" . }}
spec:
{{- if .Values.imageRegistryCredentials.enabled }}
{{- with include "chart.imagePullSecrets" . }}
imagePullSecrets:
- name: {{ .Values.imagePullSecrets }}
{{- . | nindent 8 }}
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
+1 -1
View File
@@ -14,7 +14,7 @@ image:
tag: "latest"
# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
imagePullSecrets: rustfs-regcred
imagePullSecrets: []
imageRegistryCredentials:
enabled: false