From 6152ce4577186fc68c4856e7d9f688009d255796 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sun, 21 Jul 2024 20:30:47 +0200 Subject: [PATCH] feat: Expose longhorn UI on tailnet refactor: Merge inbucket services --- kubenix-modules/bootstrap-default.nix | 44 ++++++++------------------- kubenix-modules/inbucket.nix | 30 ++++++++---------- kubenix-modules/syncthing.nix | 2 +- my-lib/globals.nix | 6 ++-- 4 files changed, 30 insertions(+), 52 deletions(-) diff --git a/kubenix-modules/bootstrap-default.nix b/kubenix-modules/bootstrap-default.nix index 4f5d9ba..81dbb8f 100644 --- a/kubenix-modules/bootstrap-default.nix +++ b/kubenix-modules/bootstrap-default.nix @@ -1,4 +1,4 @@ -{ lib, nixhelm, system, machines, ... }: { +{ lib, nixhelm, system, machines, myLib, ... }: { kubernetes = { helm.releases = { metallb = { @@ -17,6 +17,7 @@ values = { persistence.defaultClassReplicaCount = 2; + service.ui.type = "LoadBalancer"; defaultSettings = { defaultDataPath = "/mnt/longhorn"; @@ -29,6 +30,8 @@ }; resources = { + services.longhorn-frontend.spec.loadBalancerIP = myLib.globals.longhornIPv4; + namespaces = { static-websites = { }; freshrss = { }; @@ -60,36 +63,6 @@ }) machinesWithKubernetesLabels; - ingresses.longhorn = { - metadata.annotations = { - "cert-manager.io/cluster-issuer" = "letsencrypt"; - "traefik.ingress.kubernetes.io/router.entrypoints" = "localsecure"; - }; - - spec = { - ingressClassName = "traefik"; - - rules = [{ - host = "longhorn.kun.is"; - - http.paths = [{ - path = "/"; - pathType = "Prefix"; - - backend.service = { - name = "longhorn-frontend"; - port.number = 80; - }; - }]; - }]; - - tls = [{ - secretName = "longhorn-tls"; - hosts = [ "longhorn.kun.is" ]; - }]; - }; - }; - recurringJobs.backup-nfs.spec = { cron = "0 1 * * *"; # One o'clock at night task = "backup"; @@ -155,5 +128,14 @@ bazarr.storage = "25Mi"; minecraft.storage = "1Gi"; }; + + tailscaleIngresses.tailscale-longhorn = { + host = "longhorn"; + + service = { + name = "longhorn-frontend"; + portName = "http"; + }; + }; }; } diff --git a/kubenix-modules/inbucket.nix b/kubenix-modules/inbucket.nix index aed9bac..743cd5a 100644 --- a/kubenix-modules/inbucket.nix +++ b/kubenix-modules/inbucket.nix @@ -26,32 +26,28 @@ }; services = { - web.spec = { + inbucket.spec = { type = "LoadBalancer"; - loadBalancerIP = myLib.globals.inbucketWebIPv4; + loadBalancerIP = myLib.globals.inbucketIPv4; selector.app = "inbucket"; - ports.web = { - port = 80; - targetPort = "web"; + ports = { + smtp = { + port = 25; + targetPort = "smtp"; + }; + + web = { + port = 80; + targetPort = "web"; + }; }; }; - - email.spec = { - type = "LoadBalancer"; - loadBalancerIP = myLib.globals.inbucketEmailIPv4; - selector.app = "inbucket"; - - ports = [{ - port = 25; - targetPort = "smtp"; - }]; - }; }; }; lab.tailscaleIngresses.tailscale = { host = "inbucket"; - service.name = "web"; + service.name = "inbucket"; }; } diff --git a/kubenix-modules/syncthing.nix b/kubenix-modules/syncthing.nix index afae1ed..42e53b1 100644 --- a/kubenix-modules/syncthing.nix +++ b/kubenix-modules/syncthing.nix @@ -58,7 +58,7 @@ services.syncthing.spec = { type = "LoadBalancer"; - loadBalancerIP = myLib.globals.syncthingWebIPv4; + loadBalancerIP = myLib.globals.syncthingIPv4; selector.app = "syncthing"; ports.web = { diff --git a/my-lib/globals.nix b/my-lib/globals.nix index 3df3b46..602a1b8 100644 --- a/my-lib/globals.nix +++ b/my-lib/globals.nix @@ -8,9 +8,9 @@ bittorrentIPv4 = "192.168.30.133"; gitIPv4 = "192.168.30.132"; piholeIPv4 = "192.168.30.131"; - inbucketEmailIPv4 = "192.168.30.130"; + inbucketIPv4 = "192.168.30.130"; kmsIPv4 = "192.168.30.129"; traefikIPv4 = "192.168.30.128"; - inbucketWebIPv4 = "192.168.30.137"; - syncthingWebIPv4 = "192.168.30.138"; + syncthingIPv4 = "192.168.30.138"; + longhornIPv4 = "192.168.30.139"; }