Skip to content

Commit

Permalink
Support templating accessKey existingSecret and bucket name (minio#14643
Browse files Browse the repository at this point in the history
)
  • Loading branch information
yisiqi authored Apr 13, 2022
1 parent 5c53620 commit 7ce1f6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion helm/minio/templates/_helper_create_bucket.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
5 changes: 3 additions & 2 deletions helm/minio/templates/_helper_create_user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
5 changes: 3 additions & 2 deletions helm/minio/templates/post-install-create-user-job.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $global := . -}}
{{- if .Values.users }}
apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit 7ce1f6e

Please sign in to comment.