add dummy custom types for metallb

manage metallb ip address pool and l2advertisements in nix
This commit is contained in:
Pim Kunis 2024-03-25 21:25:43 +01:00
parent b4d6a9f46d
commit 3124436b46
4 changed files with 29 additions and 13 deletions

View file

@ -3,6 +3,7 @@
hosts: manager hosts: manager
roles: roles:
- {role: traefik, tags: traefik} - {role: traefik, tags: traefik}
- {role: freshrss, tags: freshrss}
- {role: forgejo, tags: forgejo} - {role: forgejo, tags: forgejo}
- {role: radicale, tags: radicale} - {role: radicale, tags: radicale}
- {role: hedgedoc, tags: hedgedoc} - {role: hedgedoc, tags: hedgedoc}

View file

@ -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

View file

@ -1,5 +0,0 @@
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: main
namespace: metallb-system

View file

@ -11,6 +11,26 @@
kubernetes = { kubernetes = {
namespace = "kubenix"; 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 = { resources = {
namespaces = { namespaces = {
kubenix = { }; 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 = { helm.releases.metallb = {
chart = nixhelm.chartsDerivations.${system}.metallb.metallb; chart = nixhelm.chartsDerivations.${system}.metallb.metallb;
namespace = "metallb-system"; namespace = "metallb-system";
includeCRDs = true;
}; };
}; };
}; };