Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pull file func #4563

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading