prole/tmp/create_buckets_dockerhub.sh

26 lines
1.7 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig
AK=$(kubectl -n gitea get secret gitlab-minio-secret -o jsonpath='{.data.accesskey}' | base64 -d)
SK=$(kubectl -n gitea get secret gitlab-minio-secret -o jsonpath='{.data.secretkey}' | base64 -d)
echo "==> Checking gitaly pod logs..."
kubectl -n gitea logs gitlab-gitaly-0 --previous --tail=15 2>&1 | grep -v LD_PRELOAD | head -15 || \
kubectl -n gitea logs gitlab-gitaly-0 --tail=15 2>&1 | grep -v LD_PRELOAD | head -15 || true
echo "==> Removing stale installer PID and restarting installer..."
rm -f /Users/chrisfu/dev/knoe/install.pid
cd /Users/chrisfu/dev/knoe && mkdir -p logs
nohup bash install.sh --silent -c conf/service/knoe.cfg > logs/install_run9.log 2>&1 &
disown
echo "Installer run 9 started"
echo "==> Creating minio buckets via Docker Hub minio/mc..."
kubectl -n gitea delete pod minio-init --ignore-not-found 2>/dev/null || true
kubectl -n gitea run minio-init \
--image=minio/mc:latest \
--restart=Never \
--overrides="{\"spec\":{\"nodeName\":\"gandalf.knoe.org\",\"tolerations\":[{\"operator\":\"Exists\"}],\"containers\":[{\"name\":\"minio-init\",\"image\":\"minio/mc:latest\",\"command\":[\"sh\",\"-c\",\"mc alias set gl http://gitlab-minio-svc.gitea.svc.cluster.local:9000 ${AK} ${SK} && for b in gitlab-registry-storage gitlab-lfs-storage gitlab-artifacts-storage gitlab-uploads-storage gitlab-packages-storage gitlab-dependency-proxy-storage gitlab-terraform-state gitlab-ci-secure-files; do mc mb --ignore-existing gl/\$b && echo created \$b; done && mc ls gl && echo BUCKETS_DONE\"]}]}}" 2>&1
echo "minio-init pod created. Check with: kubectl -n gitea logs minio-init -f"