Skip to content

Commit

Permalink
add pull file func (#4563)
Browse files Browse the repository at this point in the history
  • Loading branch information
nowinkeyy authored Mar 6, 2024
1 parent 6f3f918 commit 145ce78
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
20 changes: 20 additions & 0 deletions deploy/objectstorage/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,27 @@ export readonly ARCH=${1:-amd64}
mkdir -p tars

RetryPullImageInterval=3
RetryPullFileInterval=3
RetrySleepSeconds=3

retryPullFile() {
local file=$1
local retry=0
local retryMax=3
set +e
while [ $retry -lt $RetryPullFileInterval ]; do
curl $file --create-dirs -o ./etc/minio-binaries/mc >/dev/null && break
retry=$(($retry + 1))
echo "retry pull file $file, retry times: $retry"
sleep $RetrySleepSeconds
done
set -e
if [ $retry -eq $retryMax ]; then
echo "pull file $file failed"
exit 1
fi
}

retryPullImage() {
local image=$1
local retry=0
Expand All @@ -27,6 +46,7 @@ retryPullImage() {
retryPullImage ghcr.io/labring/sealos-cloud-objectstorage-controller:latest
retryPullImage ghcr.io/labring/sealos-cloud-objectstorage-frontend:latest
retryPullImage ghcr.io/labring/sealos-cloud-minio-service:latest
retryPullFile https://dl.min.io/client/mc/release/linux-amd64/mc

sealos save -o tars/objectstorage-controller.tar ghcr.io/labring/sealos-cloud-objectstorage-controller:latest
sealos save -o tars/objectstorage-frontend.tar ghcr.io/labring/sealos-cloud-objectstorage-frontend:latest
Expand Down
8 changes: 2 additions & 6 deletions deploy/objectstorage/scripts/minio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ function deploy_minio() {
}

function init_minio() {
if [ ! -f "$HOME/minio-binaries/mc" ]; then
curl https://dl.min.io/client/mc/release/linux-amd64/mc --create-dirs -o $HOME/minio-binaries/mc
fi

chmod +x $HOME/minio-binaries/mc
export PATH=$PATH:$HOME/minio-binaries/
chmod +x ./etc/minio-binaries/mc
export PATH=$PATH:./etc/minio-binaries/

while kubectl wait -l statefulset.kubernetes.io/pod-name=object-storage-pool-0-0 --for=condition=ready pod -n objectstorage-system --timeout=-1s 2>&1 | grep -q "error: no matching resources found"; do
sleep 1
Expand Down

0 comments on commit 145ce78

Please sign in to comment.