# ─── NFS PV für git-data (Repositories) ──────────────────────────
apiVersion: v1
kind: PersistentVolume
metadata:
  name: gitlab-git-pv
spec:
  capacity:
    storage: 50Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  mountOptions:
    - hard
    - rsize=1048576
    - wsize=1048576
    - timeo=600
    - retrans=2
  nfs:
    server: 192.168.178.166
    path: /export/gitlab

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-git-pvc
  namespace: gitlab
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: nfs
  resources:
    requests:
      storage: 50Gi
  volumeName: gitlab-git-pv

---
# ─── Lokaler PV für /var/opt/gitlab (postgresql, redis, etc.) ─────
apiVersion: v1
kind: PersistentVolume
metadata:
  name: gitlab-data-pv
spec:
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-path
  hostPath:
    path: /var/lib/gitlab/data

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-data-pvc
  namespace: gitlab
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 20Gi
  volumeName: gitlab-data-pv

---
# ─── Lokaler PV für /etc/gitlab (Konfiguration) ───────────────────
apiVersion: v1
kind: PersistentVolume
metadata:
  name: gitlab-config-pv
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-path
  hostPath:
    path: /var/lib/gitlab/config

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-config-pvc
  namespace: gitlab
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 1Gi
  volumeName: gitlab-config-pv

---
# ─── Neue Longhorn-PVCs zum Migrieren der Daten (dynamisch provisioniert) ─
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-data-longhorn-pvc
  namespace: gitlab
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 20Gi

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-config-longhorn-pvc
  namespace: gitlab
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 1Gi
