add image pull secret support (#1127)

Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
majinghe
2025-12-12 20:25:25 +08:00
committed by GitHub
parent 0bf25fdefa
commit 08be8f5472
6 changed files with 63 additions and 18 deletions
+9
View File
@@ -71,3 +71,12 @@ Return the secret name
{{- printf "%s-secret" (include "rustfs.fullname" .) }}
{{- end }}
{{- end }}
{{/*
Return image pull secret content
*/}}
{{- define "imagePullSecret" }}
{{- with .Values.imageRegistryCredentials }}
{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }}
{{- end }}
{{- end }}
+4
View File
@@ -15,6 +15,10 @@ spec:
labels:
app: {{ include "rustfs.name" . }}
spec:
{{- if .Values.imageRegistryCredentials.enabled }}
imagePullSecrets:
- name: {{ .Values.imagePullSecrets }}
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
+11
View File
@@ -8,3 +8,14 @@ data:
RUSTFS_ACCESS_KEY: {{ .Values.secret.rustfs.access_key | b64enc | quote }}
RUSTFS_SECRET_KEY: {{ .Values.secret.rustfs.secret_key | b64enc | quote }}
{{- end }}
---
{{- if .Values.imageRegistryCredentials.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.imagePullSecrets }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "imagePullSecret" . }}
{{- end }}
+4
View File
@@ -15,6 +15,10 @@ spec:
labels:
app: {{ include "rustfs.name" . }}
spec:
{{- if .Values.imageRegistryCredentials.enabled }}
imagePullSecrets:
- name: {{ .Values.imagePullSecrets }}
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
+10 -1
View File
@@ -14,7 +14,16 @@ 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: []
imagePullSecrets: rustfs-regcred
imageRegistryCredentials:
enabled: false
registry: ""
username: ""
password: ""
email: ""
# This is to override the chart name.
nameOverride: ""
fullnameOverride: ""