mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
49 lines
2.1 KiB
Bash
49 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig
|
|
|
|
echo "==> Clearing gitaly PV claimRef so Kubernetes can re-bind to gitea PVC..."
|
|
kubectl patch pv gitlab-gitaly-synology --type=json \
|
|
-p '[{"op":"remove","path":"/spec/claimRef"}]' 2>/dev/null || \
|
|
kubectl patch pv gitlab-gitaly-synology --type=merge \
|
|
-p '{"spec":{"claimRef":null}}'
|
|
|
|
echo "==> Waiting 20s for gitaly PVC to bind..."
|
|
sleep 20
|
|
kubectl -n gitea get pvc repo-data-gitlab-gitaly-0
|
|
|
|
echo "==> Getting minio credentials..."
|
|
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)
|
|
MINIO_SVC=$(kubectl -n gitea get svc gitlab-minio-svc \
|
|
-o jsonpath='{.spec.clusterIP}' 2>/dev/null || echo "gitlab-minio-svc")
|
|
|
|
echo "==> Creating minio buckets via mc (in-cluster pod on gandalf)..."
|
|
kubectl -n gitea run minio-buckets \
|
|
--image=quay.io/minio/mc:RELEASE.2022-10-20T23-30-35Z \
|
|
--restart=Never --rm --attach \
|
|
--overrides="{
|
|
\"spec\":{
|
|
\"nodeName\":\"gandalf.knoe.org\",
|
|
\"tolerations\":[{\"operator\":\"Exists\"}],
|
|
\"containers\":[{
|
|
\"name\":\"minio-buckets\",
|
|
\"image\":\"quay.io/minio/mc:RELEASE.2022-10-20T23-30-35Z\",
|
|
\"command\":[\"sh\",\"-c\",
|
|
\"mc alias set gl http://gitlab-minio-svc.gitea.svc.cluster.local:9000 ${AK} ${SK} && \
|
|
mc mb --ignore-existing gl/gitlab-registry-storage && \
|
|
mc mb --ignore-existing gl/gitlab-lfs-storage && \
|
|
mc mb --ignore-existing gl/gitlab-artifacts-storage && \
|
|
mc mb --ignore-existing gl/gitlab-uploads-storage && \
|
|
mc mb --ignore-existing gl/gitlab-packages-storage && \
|
|
mc mb --ignore-existing gl/gitlab-dependency-proxy-storage && \
|
|
mc mb --ignore-existing gl/gitlab-terraform-state && \
|
|
mc mb --ignore-existing gl/gitlab-ci-secure-files && \
|
|
mc ls gl && echo BUCKETS_DONE\"]}]}}" 2>&1
|
|
|
|
echo "==> Waiting 30s then checking all pod status..."
|
|
sleep 30
|
|
kubectl -n gitea get pods --no-headers | grep -v jemalloc-builder | sort
|