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
# Grant policy to user for specific operations
grant-policy user='' policy='readwrite':
grant-policy user='' policy='':
#!/bin/bash
set -euo pipefail
USER="{{ user }}"
POLICY="{{ policy }}"
while [ -z "${USER}" ]; do
USER=$(gum input --prompt="Username: " --width=100 --placeholder="e.g., dagster")
done
if [ -z "${POLICY}" ]; then
POLICY=$(gum choose --header="Select policy to grant:" "readwrite" "readonly" "writeonly")
fi
echo "Granting ${POLICY} policy to user ${USER}..."
@@ -264,7 +266,8 @@ grant-policy user='' policy='readwrite':
ROOT_PASSWORD=$(just root-password)
# 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} -- \
bash -c "mc alias set local http://localhost:9000 ${ROOT_USER} ${ROOT_PASSWORD} && \