Support templating accessKey existingSecret and bucket name (#14643)

This commit is contained in:
Yi Siqi 2022-04-14 02:58:29 +08:00 committed by GitHub
parent 5c53620a72
commit 7ce1f6e736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -101,8 +101,9 @@ scheme=http
connectToMinio $scheme
{{ if .Values.buckets }}
{{ $global := . }}
# Create the buckets
{{- range .Values.buckets }}
createBucket {{ .name }} {{ .policy }} {{ .purge }} {{ .versioning }}
createBucket {{ tpl .name $global }} {{ .policy }} {{ .purge }} {{ .versioning }}
{{- end }}
{{- end }}

View File

@ -76,12 +76,13 @@ scheme=http
connectToMinio $scheme
{{ if .Values.users }}
{{ $global := . }}
# Create the users
{{- range .Values.users }}
{{- if .existingSecret }}
createUser {{ .accessKey }} $(cat /config/secrets/{{ .accessKey }}) {{ .policy }}
createUser {{ tpl .accessKey $global }} $(cat /config/secrets/{{ tpl .accessKey $global }}) {{ .policy }}
{{ else }}
createUser {{ .accessKey }} {{ .secretKey }} {{ .policy }}
createUser {{ tpl .accessKey $global }} {{ .secretKey }} {{ .policy }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -1,3 +1,4 @@
{{- $global := . -}}
{{- if .Values.users }}
apiVersion: batch/v1
kind: Job
@ -60,10 +61,10 @@ spec:
{{- range .Values.users }}
{{- if .existingSecret }}
- secret:
name: {{ .existingSecret }}
name: {{ tpl .existingSecret $global }}
items:
- key: {{ .existingSecretKey }}
path: secrets/{{ .accessKey }}
path: secrets/{{ tpl .accessKey $global }}
{{- end }}
{{- end }}
{{- if .Values.tls.enabled }}