From 3124436b4670d78e6c79b41cdc32b17ba56467a5 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Mon, 25 Mar 2024 21:25:43 +0100 Subject: [PATCH] add dummy custom types for metallb manage metallb ip address pool and l2advertisements in nix --- docker_swarm/playbooks/stacks.yml | 1 + kubernetes/ip-address-pool.yaml | 8 -------- kubernetes/l2-advertisement.yaml | 5 ----- nix/flake/kubenix.nix | 28 ++++++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 13 deletions(-) delete mode 100644 kubernetes/ip-address-pool.yaml delete mode 100644 kubernetes/l2-advertisement.yaml diff --git a/docker_swarm/playbooks/stacks.yml b/docker_swarm/playbooks/stacks.yml index 862a97a..ced4d6c 100644 --- a/docker_swarm/playbooks/stacks.yml +++ b/docker_swarm/playbooks/stacks.yml @@ -3,6 +3,7 @@ hosts: manager roles: - {role: traefik, tags: traefik} + - {role: freshrss, tags: freshrss} - {role: forgejo, tags: forgejo} - {role: radicale, tags: radicale} - {role: hedgedoc, tags: hedgedoc} diff --git a/kubernetes/ip-address-pool.yaml b/kubernetes/ip-address-pool.yaml deleted file mode 100644 index 98f7820..0000000 --- a/kubernetes/ip-address-pool.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: metallb.io/v1beta1 -kind: IPAddressPool -metadata: - name: main - namespace: metallb-system -spec: - addresses: - - 192.168.40.100-192.168.40.253 diff --git a/kubernetes/l2-advertisement.yaml b/kubernetes/l2-advertisement.yaml deleted file mode 100644 index f304fdc..0000000 --- a/kubernetes/l2-advertisement.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: metallb.io/v1beta1 -kind: L2Advertisement -metadata: - name: main - namespace: metallb-system diff --git a/nix/flake/kubenix.nix b/nix/flake/kubenix.nix index 1d67f18..31c2742 100644 --- a/nix/flake/kubenix.nix +++ b/nix/flake/kubenix.nix @@ -11,6 +11,26 @@ kubernetes = { namespace = "kubenix"; + customTypes = { + # HACK: These are dummy custom types. + # This is needed, because the CRDs imported as a chart are not available as Nix modules + # There is no validation whatsoever on resources defined using these types! + # See: https://github.com/hall/kubenix/issues/34 + ipaddresspool = { + attrName = "ipaddresspools"; + group = "metallb.io"; + version = "v1beta1"; + kind = "IPAddressPool"; + }; + + l2advertisement = { + attrName = "l2advertisements"; + group = "metallb.io"; + version = "v1beta1"; + kind = "L2Advertisement"; + }; + }; + resources = { namespaces = { kubenix = { }; @@ -70,11 +90,19 @@ }]; }]; }; + + ipaddresspools.main = { + metadata.namespace = "metallb-system"; + spec.addresses = [ "192.168.40.100-192.168.40.253" ]; + }; + + l2advertisements.main.metadata.namespace = "metallb-system"; }; helm.releases.metallb = { chart = nixhelm.chartsDerivations.${system}.metallb.metallb; namespace = "metallb-system"; + includeCRDs = true; }; }; };