2023-12-24 01:10:36 +00:00
|
|
|
let
|
|
|
|
endpoints = {
|
|
|
|
"proxmox" = {
|
2024-05-04 15:27:04 +01:00
|
|
|
location = "192.168.50.3";
|
2023-12-24 01:10:36 +00:00
|
|
|
host = "proxmox.gmem.ca";
|
|
|
|
port = 8006;
|
|
|
|
protocol = "HTTPS";
|
|
|
|
};
|
|
|
|
"austin" = {
|
|
|
|
location = "192.168.50.237";
|
|
|
|
host = "austin.gmem.ca";
|
|
|
|
port = 8080;
|
2024-02-05 13:13:44 +00:00
|
|
|
protocol = "HTTP";
|
2023-12-24 01:10:36 +00:00
|
|
|
};
|
2024-02-05 13:11:43 +00:00
|
|
|
"tokyo" = {
|
|
|
|
location = "192.168.50.124";
|
|
|
|
host = "tokyo.gmem.ca";
|
|
|
|
port = 8000;
|
2024-02-05 13:13:44 +00:00
|
|
|
protocol = "HTTP";
|
2024-02-05 13:11:43 +00:00
|
|
|
};
|
|
|
|
"ibiza" = {
|
|
|
|
location = "192.168.50.182";
|
|
|
|
host = "ibiza.gmem.ca";
|
|
|
|
port = 8000;
|
2024-02-05 13:13:44 +00:00
|
|
|
protocol = "HTTP";
|
2024-02-05 13:11:43 +00:00
|
|
|
};
|
2023-12-24 01:10:36 +00:00
|
|
|
};
|
|
|
|
in {
|
2024-02-05 13:13:44 +00:00
|
|
|
kubernetes.resources.services =
|
|
|
|
builtins.mapAttrs (name: endpoint: {
|
2024-05-04 15:27:04 +01:00
|
|
|
metadata.namespace = "endpoints";
|
2024-02-05 13:13:44 +00:00
|
|
|
spec = {
|
|
|
|
ports.${name} = {
|
|
|
|
port = endpoint.port;
|
|
|
|
targetPort = endpoint.port;
|
|
|
|
};
|
2023-12-24 01:10:36 +00:00
|
|
|
};
|
2024-02-05 13:13:44 +00:00
|
|
|
})
|
|
|
|
endpoints;
|
|
|
|
kubernetes.resources.endpoints =
|
|
|
|
builtins.mapAttrs (name: endpoint: {
|
2024-05-04 15:27:04 +01:00
|
|
|
metadata.namespace = "endpoints";
|
2024-02-05 13:13:44 +00:00
|
|
|
subsets = [
|
|
|
|
{
|
|
|
|
addresses = [{ip = endpoint.location;}];
|
|
|
|
ports = [
|
|
|
|
{
|
|
|
|
name = name;
|
|
|
|
port = endpoint.port;
|
|
|
|
protocol = "TCP";
|
|
|
|
}
|
|
|
|
];
|
2023-12-24 01:10:36 +00:00
|
|
|
}
|
2024-02-05 13:13:44 +00:00
|
|
|
];
|
|
|
|
})
|
|
|
|
endpoints;
|
|
|
|
kubernetes.resources.ingresses =
|
|
|
|
builtins.mapAttrs (name: endpoint: {
|
|
|
|
metadata = {
|
|
|
|
name = name;
|
2024-05-04 15:27:04 +01:00
|
|
|
namespace = "endpoints";
|
2024-02-05 13:13:44 +00:00
|
|
|
annotations = {
|
|
|
|
"nginx.ingress.kubernetes.io/proxy-body-size" = "10g";
|
2024-05-04 15:27:04 +01:00
|
|
|
"cert-manager.io/cluser-issuer" = "le-issuer";
|
2024-02-05 13:13:44 +00:00
|
|
|
"nginx.ingress.kubernetes.io/backend-protocol" = endpoint.protocol;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
spec = {
|
|
|
|
tls = [
|
|
|
|
{
|
|
|
|
hosts = [endpoint.host];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
rules = [
|
|
|
|
{
|
|
|
|
host = endpoint.host;
|
|
|
|
http.paths = [
|
|
|
|
{
|
|
|
|
path = "/";
|
|
|
|
pathType = "Prefix";
|
|
|
|
backend.service = {
|
|
|
|
name = name;
|
|
|
|
port.number = endpoint.port;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
endpoints;
|
2023-12-24 01:10:36 +00:00
|
|
|
}
|