From a80dce42b0599c6831c242f8939fce8393e5c609 Mon Sep 17 00:00:00 2001 From: baschno Date: Tue, 30 Dec 2025 20:03:23 +0100 Subject: [PATCH] add support for Longhorn setup --- {longhorn => Longhorn}/README.md | 1 - Longhorn/auth | 1 + Longhorn/justfile | 61 +++++++++++++++++++ .../longhorn-certificate-gomplate.yaml | 2 +- .../longhorn-ingressroute-gomplate.yaml | 2 +- {longhorn => Longhorn}/longhorn-values.yaml | 0 justfile | 3 +- longhorn/longhorn-ingress.yaml | 25 -------- 8 files changed, 66 insertions(+), 29 deletions(-) rename {longhorn => Longhorn}/README.md (99%) create mode 100644 Longhorn/auth create mode 100644 Longhorn/justfile rename longhorn/longhorn-certificate.yaml => Longhorn/longhorn-certificate-gomplate.yaml (83%) rename longhorn/longhorn-ingressroute.yaml => Longhorn/longhorn-ingressroute-gomplate.yaml (81%) rename {longhorn => Longhorn}/longhorn-values.yaml (100%) delete mode 100644 longhorn/longhorn-ingress.yaml diff --git a/longhorn/README.md b/Longhorn/README.md similarity index 99% rename from longhorn/README.md rename to Longhorn/README.md index 650ba51..74a31f3 100644 --- a/longhorn/README.md +++ b/Longhorn/README.md @@ -171,5 +171,4 @@ Mit diesen Schritten hast du ein Persistent Volume (PV) und einen Persistent Vol kubectl get storageclass kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}' - ``` diff --git a/Longhorn/auth b/Longhorn/auth new file mode 100644 index 0000000..90b1243 --- /dev/null +++ b/Longhorn/auth @@ -0,0 +1 @@ +basti:$apr1$N23gJpBe$CYlDcwTfp8YsQMq0UcADQ0 diff --git a/Longhorn/justfile b/Longhorn/justfile new file mode 100644 index 0000000..e7d4296 --- /dev/null +++ b/Longhorn/justfile @@ -0,0 +1,61 @@ +set fallback:=true + +export LONGHORN_NAMESPACE := env("LONGHORN_NAMESPACE","longhorn-system") + +add-helm-repo: + helm repo add longhorn https://charts.longhorn.io --force-update + helm repo update + +# Delete namespace +delete-namespace: + #!/bin/bash + set -euo pipefail + if kubectl get namespace ${LONGHORN_NAMESPACE} &>/dev/null; then + kubectl delete namespace ${LONGHORN_NAMESPACE} --ignore-not-found + else + echo "Namespace ${LONGHORN_NAMESPACE} does not exist." + fi + + +install: + #!/bin/bash + set -euo pipefail + just env::check + + just add-helm-repo + + helm upgrade longhorn longhorn/longhorn \ + --install \ + --cleanup-on-fail \ + --namespace ${LONGHORN_NAMESPACE} \ + --create-namespace + +uninstall: + #!/bin/bash + set -euo pipefail + + for crd in $(kubectl get crd -o name | grep longhorn); do + kubectl patch $crd -p '{"metadata":{"finalizers":[]}}' --type=merge + done + + kubectl -n ${LONGHORN_NAMESPACE} patch -p '{"value": "true"}' --type=merge lhs deleting-confirmation-flag || true + + helm uninstall longhorn --namespace ${LONGHORN_NAMESPACE} || true + just delete-namespace + + +install-dashboard-ingress: + #!/bin/bash + set -euo pipefail + just env::check + + echo "Deploying Longhorn Dashboard Ingress with EXTERNAL_DOMAIN=${EXTERNAL_DOMAIN}" + gomplate -f longhorn-certificate-gomplate.yaml | kubectl apply -f - + gomplate -f longhorn-ingressroute-gomplate.yaml | kubectl apply -f - + +uninstall-dashboard-ingress: + #!/bin/bash + set -euo pipefail + + kubectl delete -f longhorn-ingressroute-gomplate.yaml || true + kubectl delete -f longhorn-certificate-gomplate.yaml || true \ No newline at end of file diff --git a/longhorn/longhorn-certificate.yaml b/Longhorn/longhorn-certificate-gomplate.yaml similarity index 83% rename from longhorn/longhorn-certificate.yaml rename to Longhorn/longhorn-certificate-gomplate.yaml index 4ebfe71..544a04d 100644 --- a/longhorn/longhorn-certificate.yaml +++ b/Longhorn/longhorn-certificate-gomplate.yaml @@ -7,7 +7,7 @@ metadata: spec: secretName: longhorn-web-ui-tls dnsNames: - - longhorn-dashboard.k8s.schnrbs.work + - longhorn-dashboard.{{.Env.EXTERNAL_DOMAIN}} issuerRef: name: cloudflare-cluster-issuer kind: ClusterIssuer \ No newline at end of file diff --git a/longhorn/longhorn-ingressroute.yaml b/Longhorn/longhorn-ingressroute-gomplate.yaml similarity index 81% rename from longhorn/longhorn-ingressroute.yaml rename to Longhorn/longhorn-ingressroute-gomplate.yaml index 20258de..f5a5263 100644 --- a/longhorn/longhorn-ingressroute.yaml +++ b/Longhorn/longhorn-ingressroute-gomplate.yaml @@ -7,7 +7,7 @@ spec: entryPoints: - websecure routes: - - match: Host(`longhorn-dashboard.k8s.schnrbs.work`) + - match: Host(`longhorn-dashboard.{{.Env.EXTERNAL_DOMAIN}}`) kind: Rule services: - name: longhorn-frontend diff --git a/longhorn/longhorn-values.yaml b/Longhorn/longhorn-values.yaml similarity index 100% rename from longhorn/longhorn-values.yaml rename to Longhorn/longhorn-values.yaml diff --git a/justfile b/justfile index e309b57..2c7b0c1 100644 --- a/justfile +++ b/justfile @@ -9,4 +9,5 @@ default: mod env mod BasicSetup '01_Basic_Setup' mod MetalLbSetup 'Metallb_Setup' -mod Traefik \ No newline at end of file +mod Traefik +mod Longhorn \ No newline at end of file diff --git a/longhorn/longhorn-ingress.yaml b/longhorn/longhorn-ingress.yaml deleted file mode 100644 index 2849998..0000000 --- a/longhorn/longhorn-ingress.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: longhorn-web-ui - namespace: longhorn-system - annotations: - traefik.ingress.kubernetes.io/router.entrypoints: websecure -spec: - rules: - - host: longhorn.k8s.internal.schnrbs.work - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: longhorn-frontend - port: - number: 80 - tls: - - hosts: - - longhorn.k8s.internal.schnrbs.work - secretName: longhorn-web-ui-tls -