From 0d2b2b90f7eb83ecf03614b0ed501d97e7a7bd89 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sun, 14 Jul 2024 15:31:58 +0200 Subject: [PATCH] feat(blog): Move to static-websites k8s namespace refactor(cyberchef): Move to static-websites k8s namespace --- README.md | 1 + flake-parts/kubenix.nix | 6 ++++-- flake.lock | 9 +++++---- flake.nix | 3 ++- kubenix-modules/all.nix | 1 - kubenix-modules/base.nix | 2 +- kubenix-modules/blog.nix | 21 +++++++++------------ kubenix-modules/cyberchef.nix | 8 ++++---- 8 files changed, 26 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index fcf617c..c4a6222 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Currently, the applications being deployed like this are: - `radicale` - `kms` - `atuin` +- `blog` ## Known bugs diff --git a/flake-parts/kubenix.nix b/flake-parts/kubenix.nix index 470fbb7..b4caeed 100644 --- a/flake-parts/kubenix.nix +++ b/flake-parts/kubenix.nix @@ -38,7 +38,7 @@ mkDeployScriptAndManifest = module: applyset: namespace: let kubernetes = (kubenix.evalModules.${system} { - specialArgs = { inherit namespace myLib; }; + specialArgs = { inherit namespace myLib blog-pim; }; module = { kubenix, ... }: { @@ -65,7 +65,7 @@ kubenix.bootstrap.deploy = mkKubenixPackage "${self}/kubenix-modules/base.nix"; kubenix.cyberchef = mkDeployScriptAndManifest - "${self}/kubenix-modules/cyberchef.nix" "cyberchef" "cyberchef"; + "${self}/kubenix-modules/cyberchef.nix" "cyberchef" "static-websites"; kubenix.freshrss = mkDeployScriptAndManifest "${self}/kubenix-modules/freshrss.nix" "freshrss" "freshrss"; kubenix.radicale = mkDeployScriptAndManifest @@ -74,4 +74,6 @@ "${self}/kubenix-modules/kms.nix" "kms" "kms"; kubenix.atuin = mkDeployScriptAndManifest "${self}/kubenix-modules/atuin.nix" "atuin" "atuin"; + kubenix.blog = mkDeployScriptAndManifest + "${self}/kubenix-modules/blog.nix" "blog" "static-websites"; }) diff --git a/flake.lock b/flake.lock index fcf039e..68aecb0 100644 --- a/flake.lock +++ b/flake.lock @@ -9,15 +9,16 @@ ] }, "locked": { - "lastModified": 1716491160, - "narHash": "sha256-dA6+BRp3ptxdgsysrVE5i+asQA8Yk5TTLnr+8hPNzrg=", + "lastModified": 1715503080, + "narHash": "sha256-/VnzHTpTq3u0z2Vgu/vKU0SHwOUIu8olHDORWT0IofM=", "ref": "refs/heads/master", - "rev": "e82fb4539d51da22b6a01e50416ef6ecb548c681", - "revCount": 22, + "rev": "7296f7f5bf5f089a5137036dcbd8058cf3e4a9e5", + "revCount": 21, "type": "git", "url": "https://git.kun.is/home/blog-pim" }, "original": { + "rev": "7296f7f5bf5f089a5137036dcbd8058cf3e4a9e5", "type": "git", "url": "https://git.kun.is/home/blog-pim" } diff --git a/flake.nix b/flake.nix index 23f85a8..f3add24 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,8 @@ }; blog-pim = { - url = "git+https://git.kun.is/home/blog-pim"; + # HACK: pinning this to a specific revision, as my automation is broken. + url = "git+https://git.kun.is/home/blog-pim?rev=7296f7f5bf5f089a5137036dcbd8058cf3e4a9e5"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/kubenix-modules/all.nix b/kubenix-modules/all.nix index 67a3363..3dd9a49 100644 --- a/kubenix-modules/all.nix +++ b/kubenix-modules/all.nix @@ -11,7 +11,6 @@ let ./media.nix ./bind9 ./dnsmasq.nix - ./blog.nix ./attic.nix ./immich.nix # ./argo.nix diff --git a/kubenix-modules/base.nix b/kubenix-modules/base.nix index a94ef8a..c06e2b2 100644 --- a/kubenix-modules/base.nix +++ b/kubenix-modules/base.nix @@ -61,7 +61,7 @@ resources = { namespaces = { - cyberchef = { }; + static-websites = { }; freshrss = { }; radicale = { }; kms = { }; diff --git a/kubenix-modules/blog.nix b/kubenix-modules/blog.nix index bd1e2c4..3dd65ab 100644 --- a/kubenix-modules/blog.nix +++ b/kubenix-modules/blog.nix @@ -1,19 +1,16 @@ { blog-pim, ... }: { kubernetes.resources = { - deployments.blog = { - metadata.labels.app = "blog"; + deployments.blog.spec = { + replicas = 3; + selector.matchLabels.app = "blog"; - spec = { - selector.matchLabels.app = "blog"; + template = { + metadata.labels.app = "blog"; - template = { - metadata.labels.app = "blog"; - - spec = { - containers.blog = { - image = "git.kun.is/home/blog-pim:${blog-pim.rev}"; - ports.web.containerPort = 80; - }; + spec = { + containers.blog = { + image = "git.kun.is/home/blog-pim:${blog-pim.rev}"; + ports.web.containerPort = 80; }; }; }; diff --git a/kubenix-modules/cyberchef.nix b/kubenix-modules/cyberchef.nix index 94301c8..19c2578 100644 --- a/kubenix-modules/cyberchef.nix +++ b/kubenix-modules/cyberchef.nix @@ -1,6 +1,6 @@ { kubernetes.resources = { - deployments.server.spec = { + deployments.cyberchef.spec = { replicas = 3; selector.matchLabels.app = "cyberchef"; @@ -14,7 +14,7 @@ }; }; - services.server.spec = { + services.cyberchef.spec = { selector.app = "cyberchef"; ports.web = { @@ -24,11 +24,11 @@ }; }; - lab.ingresses.server = { + lab.ingresses.cyberchef = { host = "cyberchef.kun.is"; service = { - name = "server"; + name = "cyberchef"; portName = "web"; }; };