mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
chore(access): network.networks.global
This commit is contained in:
parent
4662495775
commit
dd30009b7e
5 changed files with 44 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
|||
"network": {
|
||||
"hostName": "aya",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.73",
|
||||
"address6": "fd0c::49",
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
"network": {
|
||||
"hostName": "chen",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": null,
|
||||
|
|
@ -39,6 +41,7 @@
|
|||
"network": {
|
||||
"hostName": "ct",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": null,
|
||||
|
|
@ -53,6 +56,7 @@
|
|||
"network": {
|
||||
"hostName": "extern-test",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": null,
|
||||
"tail": null
|
||||
|
|
@ -63,6 +67,7 @@
|
|||
"network": {
|
||||
"hostName": "idp",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.170",
|
||||
"address6": "fd0c::aa",
|
||||
|
|
@ -81,6 +86,7 @@
|
|||
"network": {
|
||||
"hostName": "freepbx",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.43",
|
||||
|
|
@ -95,6 +101,7 @@
|
|||
"network": {
|
||||
"hostName": "gengetsu",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.61",
|
||||
|
|
@ -109,6 +116,7 @@
|
|||
"network": {
|
||||
"hostName": "hakurei",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.71",
|
||||
"address6": "fd0c::47",
|
||||
|
|
@ -131,6 +139,7 @@
|
|||
"network": {
|
||||
"hostName": "idrac-gengetsu",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.12",
|
||||
|
|
@ -145,6 +154,7 @@
|
|||
"network": {
|
||||
"hostName": "idrac-mugetsu",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.13",
|
||||
|
|
@ -159,6 +169,7 @@
|
|||
"network": {
|
||||
"hostName": "kasen",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.49",
|
||||
|
|
@ -177,6 +188,7 @@
|
|||
"network": {
|
||||
"hostName": "keycloak",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.75",
|
||||
"address6": "fd0c::4b",
|
||||
|
|
@ -195,6 +207,7 @@
|
|||
"network": {
|
||||
"hostName": "kitchencam",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": null,
|
||||
|
|
@ -209,6 +222,7 @@
|
|||
"network": {
|
||||
"hostName": "koishi",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.68",
|
||||
|
|
@ -223,6 +237,7 @@
|
|||
"network": {
|
||||
"hostName": "kuwubernetes",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.42",
|
||||
|
|
@ -237,6 +252,7 @@
|
|||
"network": {
|
||||
"hostName": "kvm-reisen",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.9",
|
||||
|
|
@ -255,6 +271,7 @@
|
|||
"network": {
|
||||
"hostName": "litterbox",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.74",
|
||||
"address6": "fd0c::4a",
|
||||
|
|
@ -277,6 +294,7 @@
|
|||
"network": {
|
||||
"hostName": "logistics",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.63",
|
||||
|
|
@ -291,6 +309,7 @@
|
|||
"network": {
|
||||
"hostName": "mediabox",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.70",
|
||||
"address6": "fd0c::46",
|
||||
|
|
@ -313,6 +332,7 @@
|
|||
"network": {
|
||||
"hostName": "minecraft",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.51",
|
||||
|
|
@ -331,6 +351,7 @@
|
|||
"network": {
|
||||
"hostName": "mugetsu",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.60",
|
||||
|
|
@ -345,6 +366,7 @@
|
|||
"network": {
|
||||
"hostName": "nue",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.62",
|
||||
|
|
@ -363,6 +385,7 @@
|
|||
"network": {
|
||||
"hostName": "reimu",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.72",
|
||||
"address6": "fd0c::48",
|
||||
|
|
@ -385,6 +408,7 @@
|
|||
"network": {
|
||||
"hostName": "reisen",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.2",
|
||||
"address6": "fd0c::2",
|
||||
|
|
@ -403,6 +427,7 @@
|
|||
"network": {
|
||||
"hostName": "sakuya",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.50",
|
||||
|
|
@ -421,6 +446,7 @@
|
|||
"network": {
|
||||
"hostName": "shanghai",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.32",
|
||||
|
|
@ -439,6 +465,7 @@
|
|||
"network": {
|
||||
"hostName": "tei",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.69",
|
||||
"address6": "fd0c::45",
|
||||
|
|
@ -461,6 +488,7 @@
|
|||
"network": {
|
||||
"hostName": "tewi",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": null,
|
||||
|
|
@ -479,6 +507,7 @@
|
|||
"network": {
|
||||
"hostName": "u7-pro",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": null,
|
||||
"local": {
|
||||
"address4": "10.1.1.3",
|
||||
|
|
@ -493,6 +522,7 @@
|
|||
"network": {
|
||||
"hostName": "utsuho",
|
||||
"networks": {
|
||||
"global": null,
|
||||
"int": {
|
||||
"address4": "10.9.1.76",
|
||||
"address6": "fd0c::4c",
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@
|
|||
int = null;
|
||||
local = null;
|
||||
tail = null;
|
||||
global = null;
|
||||
}
|
||||
// mapAttrs' (_: network:
|
||||
nameValuePair network.name {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@
|
|||
fallback =
|
||||
if nameAllowed
|
||||
then lib.warn "getAddressFor hostname fallback for ${config.networking.hostName} -> ${hostName}@${network}" (access.getHostnameFor hostName network)
|
||||
else if forSystem.access.global.enable
|
||||
then lib.warn "getAddressFor global fallback for ${config.networking.hostName} -> ${hostName}@${network}" (mkGetAddressFor true addressForAttr hostName "global")
|
||||
else err;
|
||||
global = forSystem.access.${addressForAttr}.global or forSystem.access.address4ForNetwork.global or fallback;
|
||||
local = forSystem.access.${addressForAttr}.local or forSystem.access.address4ForNetwork.local or fallback;
|
||||
int = forSystem.access.${addressForAttr}.int or forSystem.access.address4ForNetwork.int or fallback;
|
||||
tail = forSystem.access.${addressForAttr}.tail or fallback;
|
||||
|
|
@ -66,6 +69,8 @@
|
|||
then int
|
||||
else if has'Local && forSystemHas "local"
|
||||
then local
|
||||
else if forSystem.access.global.enable && forSystemHas "global"
|
||||
then global
|
||||
else fallback;
|
||||
${
|
||||
if has'Local
|
||||
|
|
@ -85,6 +90,7 @@
|
|||
else null
|
||||
} =
|
||||
tail;
|
||||
global = global;
|
||||
}
|
||||
.${network}
|
||||
or fallback;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
prefix = "fd0a:";
|
||||
};
|
||||
int.slaac.prefix = "fd0c:";
|
||||
global.domain = systemConfig.access.domain;
|
||||
};
|
||||
in {
|
||||
options = with lib.types; {
|
||||
|
|
@ -68,7 +69,7 @@
|
|||
);
|
||||
postfix = mkIf (config.macAddress != null) (mkOptionDefault (eui64 config.macAddress));
|
||||
};
|
||||
domain = mkOptionDefault "${config.name}.${systemConfig.access.domain}";
|
||||
domain = mkOptionDefault knownNetworks.${config.name}.domain or "${config.name}.${systemConfig.access.domain}";
|
||||
fqdn = mkOptionDefault (mapNullable (domain: "${systemConfig.access.hostName}.${domain}") config.domain);
|
||||
address6 = mkIf config.slaac.enable (mkOptionDefault "${config.slaac.prefix}:${config.slaac.postfix}");
|
||||
};
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ locals {
|
|||
tailscale_v4 = coalesce(var.tailscale_v4, local.tailscale_net.address4, local.empty_address)
|
||||
tailscale_v6 = coalesce(var.tailscale_v6, local.tailscale_net.address6, local.empty_address)
|
||||
global_name = coalesce(var.global_name, local.name)
|
||||
global_net = coalesce(var.net_data.networks.global, local.empty_net)
|
||||
global_v4 = coalesce(var.global_v4, local.global_net.address4, local.empty_address)
|
||||
global_v6 = coalesce(var.global_v6, local.global_net.address6, local.empty_address)
|
||||
|
||||
has_tailscale = local.tailscale_v4 != local.empty_address || local.tailscale_v6 != local.empty_address
|
||||
has_int = local.int_v4 != local.empty_address || local.int_v6 != local.empty_address
|
||||
|
|
@ -114,7 +117,7 @@ locals {
|
|||
},
|
||||
{
|
||||
name = local.global_name,
|
||||
value = var.global_v4,
|
||||
value = local.global_v4,
|
||||
},
|
||||
{
|
||||
name = local.int_name,
|
||||
|
|
@ -133,7 +136,7 @@ locals {
|
|||
},
|
||||
{
|
||||
name = local.global_name,
|
||||
value = var.global_v6,
|
||||
value = local.global_v6,
|
||||
},
|
||||
{
|
||||
name = local.int_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue