fix(minio): fix minio::grant-policy

This commit is contained in:
Masaki Yatsu
2025-09-29 21:17:48 +09:00
parent 84b96cc4e4
commit c0739bd9c0

View File

@@ -248,15 +248,17 @@ get-user-credentials user='':
fi fi
# Grant policy to user for specific operations # Grant policy to user for specific operations
grant-policy user='' policy='readwrite': grant-policy user='' policy='':
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
USER="{{ user }}" USER="{{ user }}"
POLICY="{{ policy }}" POLICY="{{ policy }}"
while [ -z "${USER}" ]; do while [ -z "${USER}" ]; do
USER=$(gum input --prompt="Username: " --width=100 --placeholder="e.g., dagster") USER=$(gum input --prompt="Username: " --width=100 --placeholder="e.g., dagster")
done done
if [ -z "${POLICY}" ]; then
POLICY=$(gum choose --header="Select policy to grant:" "readwrite" "readonly" "writeonly")
fi
echo "Granting ${POLICY} policy to user ${USER}..." echo "Granting ${POLICY} policy to user ${USER}..."
@@ -264,7 +266,8 @@ grant-policy user='' policy='readwrite':
ROOT_PASSWORD=$(just root-password) ROOT_PASSWORD=$(just root-password)
# Get the MinIO pod name dynamically # Get the MinIO pod name dynamically
MINIO_POD=$(kubectl get pods -n ${MINIO_NAMESPACE} -l app.kubernetes.io/name=minio -o jsonpath='{.items[0].metadata.name}') MINIO_POD=$(kubectl get pods -n ${MINIO_NAMESPACE} -l app=minio \
-o jsonpath='{.items[0].metadata.name}')
kubectl -n ${MINIO_NAMESPACE} exec ${MINIO_POD} -- \ kubectl -n ${MINIO_NAMESPACE} exec ${MINIO_POD} -- \
bash -c "mc alias set local http://localhost:9000 ${ROOT_USER} ${ROOT_PASSWORD} && \ bash -c "mc alias set local http://localhost:9000 ${ROOT_USER} ${ROOT_PASSWORD} && \