mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
54 lines
2.3 KiB
Bash
54 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig
|
|
|
|
echo "==> Removing pv-protection finalizer from gitaly PV..."
|
|
kubectl patch pv gitlab-gitaly-synology \
|
|
-p '{"metadata":{"finalizers":[]}}' --type=merge 2>/dev/null || true
|
|
|
|
echo "==> Waiting 10s for PV deletion..."
|
|
sleep 10
|
|
kubectl get pv gitlab-gitaly-synology 2>&1 || echo "PV gone OK"
|
|
|
|
echo "==> Recreating PV (clean, no claimRef)..."
|
|
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.knoe.org]
|
|
PVYAML
|
|
|
|
echo "==> Waiting 20s for PVC to bind..."
|
|
sleep 20
|
|
echo "==> PV phase:" && kubectl get pv gitlab-gitaly-synology \
|
|
-o jsonpath='{.status.phase}' && echo
|
|
echo "==> PVC status:"
|
|
kubectl -n gitea get pvc repo-data-gitlab-gitaly-0
|
|
|
|
echo "==> Starting minio-init bucket creation (background)..."
|
|
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.knoe.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} && 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; done && mc ls gl && echo BUCKETS_DONE\"]}]}}" 2>&1
|
|
echo "==> minio-init pod created — check logs in ~2min with:"
|
|
echo " kubectl -n gitea logs minio-init"
|