Skip to content

Commit

Permalink
feat(buckets): add CRYOSTAT_BUCKETS for pre-created buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Jan 17, 2024
1 parent 4b69e2c commit 80d55e4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cryostat-entrypoint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ set -xe
cfg="$(mktemp)"
envsubst '$CRYOSTAT_ACCESS_KEY $CRYOSTAT_SECRET_KEY' < /etc/seaweed_conf.template.json > "${cfg}"

function createBuckets() {
for i in $(echo "$CRYOSTAT_BUCKETS" | tr ',' '\n'); do
local len
len="${#i}"
if [ "${len}" -lt 3 ]; then
echo "Bucket names must be at least 3 characters"
exit 1
fi
if [ "${len}" -gt 63 ]; then
echo "Bucket names must be at most 63 characters"
exit 1
fi
local cmd
# FIXME do something better than sleeping here
cmd="sleep ${BUCKET_CREATION_STARTUP_SECONDS:-30} ; echo \"s3.bucket.create -name ${i}\" | weed shell"
bash -c "${cmd}" &
done
}
createBuckets

exec /usr/bin/entrypoint.sh \
server -dir="${DATA_DIR:-/tmp}" \
-s3 -s3.config="${cfg}" \
Expand Down

0 comments on commit 80d55e4

Please sign in to comment.