Format repo

This commit is contained in:
Pim Kunis 2024-10-28 16:05:06 +01:00
parent 3169149045
commit 8160b9da0b
37 changed files with 643 additions and 392 deletions

View file

@ -1,12 +1,16 @@
{ lib, config, ... }: {
{
lib,
config,
...
}: {
options = with lib.types; {
lab.tailscaleIngresses = lib.mkOption {
type = attrsOf (submodule {
options = {
host = lib.mkOption { type = str; };
host = lib.mkOption {type = str;};
service = {
name = lib.mkOption { type = str; };
name = lib.mkOption {type = str;};
portName = lib.mkOption {
type = str;
@ -16,37 +20,44 @@
};
});
default = { };
default = {};
};
};
config =
let
cfg = config.lab.tailscaleIngresses;
config = let
cfg = config.lab.tailscaleIngresses;
mkTailscaleIngress = name: { host, service }: {
spec = {
ingressClassName = "tailscale";
mkTailscaleIngress = name: {
host,
service,
}: {
spec = {
ingressClassName = "tailscale";
rules = [{
http.paths = [{
path = "/";
pathType = "Prefix";
rules = [
{
http.paths = [
{
path = "/";
pathType = "Prefix";
backend.service = {
name = service.name;
port.name = service.portName;
};
}];
}];
backend.service = {
name = service.name;
port.name = service.portName;
};
}
];
}
];
tls = [{
hosts = [ host ];
}];
};
tls = [
{
hosts = [host];
}
];
};
in
{
kubernetes.resources.ingresses = builtins.mapAttrs mkTailscaleIngress cfg;
};
in {
kubernetes.resources.ingresses = builtins.mapAttrs mkTailscaleIngress cfg;
};
}