mirror of
https://github.com/minio/minio.git
synced 2025-04-19 18:17:30 -04:00
Allow bootstrapping policies with special characters in Helm (#14356)
If the policy fails MinIO's minimum threshold for a valid policy, they'll still (correctly) fail, but policies with a : (and probably a /) should be allowed since they work with standard MC/MinIO Console interactions. This creates the files as policy_IDX.json instead of <name>.json to avoid any issues with the name + Kubernetes ConfigMaps since ConfigMap keys must be: [-._a-zA-Z0-9]+
This commit is contained in:
parent
23930355a7
commit
a2bc383e15
@ -43,17 +43,19 @@ checkPolicyExists() {
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
# createPolicy($name)
|
# createPolicy($name, $filename)
|
||||||
createPolicy () {
|
createPolicy () {
|
||||||
NAME=$1
|
NAME=$1
|
||||||
|
FILENAME=$2
|
||||||
|
|
||||||
# Create the name if it does not exist
|
# Create the name if it does not exist
|
||||||
|
echo "Checking policy: $NAME (in /config/$FILENAME.json)"
|
||||||
if ! checkPolicyExists $NAME ; then
|
if ! checkPolicyExists $NAME ; then
|
||||||
echo "Creating policy '$NAME'"
|
echo "Creating policy '$NAME'"
|
||||||
else
|
else
|
||||||
echo "Policy '$NAME' already exists."
|
echo "Policy '$NAME' already exists."
|
||||||
fi
|
fi
|
||||||
${MC} admin policy add myminio $NAME /config/$NAME.json
|
${MC} admin policy add myminio $NAME /config/$FILENAME.json
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ connectToMinio $scheme
|
|||||||
|
|
||||||
{{ if .Values.policies }}
|
{{ if .Values.policies }}
|
||||||
# Create the policies
|
# Create the policies
|
||||||
{{- range .Values.policies }}
|
{{- range $idx, $policy := .Values.policies }}
|
||||||
createPolicy {{ .name }}
|
createPolicy {{ $policy.name }} policy_{{ $idx }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
@ -15,8 +15,9 @@ data:
|
|||||||
{{ include (print $.Template.BasePath "/_helper_create_user.txt") . | indent 4 }}
|
{{ include (print $.Template.BasePath "/_helper_create_user.txt") . | indent 4 }}
|
||||||
add-policy: |-
|
add-policy: |-
|
||||||
{{ include (print $.Template.BasePath "/_helper_create_policy.txt") . | indent 4 }}
|
{{ include (print $.Template.BasePath "/_helper_create_policy.txt") . | indent 4 }}
|
||||||
{{- range .Values.policies }}
|
{{- range $idx, $policy := .Values.policies }}
|
||||||
{{ .name }}.json: |-
|
# {{ $policy.name }}
|
||||||
|
policy_{{ $idx }}.json: |-
|
||||||
{{ include (print $.Template.BasePath "/_helper_policy.tpl") . | indent 4 }}
|
{{ include (print $.Template.BasePath "/_helper_policy.tpl") . | indent 4 }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
custom-command: |-
|
custom-command: |-
|
||||||
|
Loading…
x
Reference in New Issue
Block a user