mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 10:13:58 +00:00
64 lines
1.7 KiB
Bash
64 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig
|
|
KB="kubectl"
|
|
|
|
echo "==> Deleting wrong PVs (wrong storageClass)..."
|
|
$KB delete pv gitlab-gitaly-synology gitlab-minio-synology --ignore-not-found
|
|
|
|
GITALY_SIZE=$($KB -n gitlab get pvc repo-data-gitlab-gitaly-0 -o jsonpath='{.spec.resources.requests.storage}' 2>/dev/null || echo "50Gi")
|
|
MINIO_SIZE=$($KB -n gitlab get pvc gitlab-minio -o jsonpath='{.spec.resources.requests.storage}' 2>/dev/null || echo "10Gi")
|
|
echo "==> PVC sizes: gitaly=$GITALY_SIZE minio=$MINIO_SIZE"
|
|
|
|
echo "==> Creating PVs with empty storageClassName to match <unset> PVCs..."
|
|
$KB apply -f - <<PVYAML
|
|
apiVersion: v1
|
|
kind: PersistentVolume
|
|
metadata:
|
|
name: gitlab-gitaly-synology
|
|
spec:
|
|
capacity:
|
|
storage: ${GITALY_SIZE}
|
|
accessModes: [ReadWriteOnce]
|
|
persistentVolumeReclaimPolicy: Retain
|
|
storageClassName: ""
|
|
local:
|
|
path: /synology/d005/gitlab/gitaly
|
|
nodeAffinity:
|
|
required:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: kubernetes.io/hostname
|
|
operator: In
|
|
values: [gandalf.prole.org]
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolume
|
|
metadata:
|
|
name: gitlab-minio-synology
|
|
spec:
|
|
capacity:
|
|
storage: ${MINIO_SIZE}
|
|
accessModes: [ReadWriteOnce]
|
|
persistentVolumeReclaimPolicy: Retain
|
|
storageClassName: ""
|
|
local:
|
|
path: /synology/d005/gitlab/minio
|
|
nodeAffinity:
|
|
required:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: kubernetes.io/hostname
|
|
operator: In
|
|
values: [gandalf.prole.org]
|
|
PVYAML
|
|
|
|
echo "==> Waiting 15s for binding..."
|
|
sleep 15
|
|
|
|
echo "==> PVC status:"
|
|
$KB -n gitlab get pvc
|
|
|
|
echo "==> PV status:"
|
|
$KB get pv gitlab-gitaly-synology gitlab-minio-synology
|