prole/tmp/fix_pv_and_buckets_v3.sh
chrisfu b4fc5641db checkpoint: sanitize prole config for host portability
- fix conf/prod/prole.cfg by replacing hardcoded /Users/chrisfu paths with /Users/chrisfu

- remove injected [update.sh] log lines and stray password artifacts so config is executable

- include latest pending updates across deployment config, UI/core flow, vault/network artifacts, and helper scripts
2026-04-10 05:58:40 -07:00

63 lines
2.8 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
export KUBECONFIG=/Users/chrisfu/dev/prole/prole-k3s.kubeconfig
echo "==> Deleting old gitaly PV (still bound to deleted gitlab ns)..."
kubectl delete pv gitlab-gitaly-synology --ignore-not-found
echo "==> Recreating gitaly PV bound to gitea namespace..."
kubectl apply -f - <<'PVYAML'
apiVersion: v1
kind: PersistentVolume
metadata:
name: gitlab-gitaly-synology
spec:
capacity:
storage: 50Gi
accessModes: [ReadWriteOnce]
persistentVolumeReclaimPolicy: Retain
storageClassName: ""
volumeMode: Filesystem
local:
path: /synology/d005/gitlab/gitaly
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values: [gandalf.prole.org]
PVYAML
echo "==> Waiting 20s for gitaly PVC to bind..."
sleep 20
kubectl -n gitea get pvc repo-data-gitlab-gitaly-0
echo "==> Creating minio buckets via dedicated mc pod..."
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)
kubectl -n gitea delete pod minio-init --ignore-not-found 2>/dev/null || true
kubectl -n gitea run minio-init \
--image=quay.io/minio/mc:RELEASE.2022-10-20T23-30-35Z \
--restart=Never \
--overrides="{
\"spec\":{\"nodeName\":\"gandalf.prole.org\",\"tolerations\":[{\"operator\":\"Exists\"}],
\"containers\":[{\"name\":\"minio-init\",
\"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\"]}]}}"
echo "==> Waiting up to 3min for minio-init job to complete..."
kubectl -n gitea wait pod/minio-init --for=condition=Ready --timeout=120s 2>/dev/null || true
kubectl -n gitea wait pod/minio-init --for=jsonpath='{.status.phase}'=Succeeded --timeout=60s 2>/dev/null || true
kubectl -n gitea logs minio-init 2>&1 | tail -15
kubectl -n gitea delete pod minio-init --ignore-not-found 2>/dev/null || true
echo "==> Restarting registry pod to pick up new buckets..."
kubectl -n gitea delete pod -l app=registry --ignore-not-found
echo "==> Final pod status (60s wait):"
sleep 60
kubectl -n gitea get pods --no-headers | grep -v jemalloc-builder | sort