modules/cluster/deployment: let microvms specify their nets by providing just a default
This commit is contained in:
parent
65a91dc324
commit
7bc3b49cc3
|
@ -1,4 +1,4 @@
|
||||||
{ lib, ... }:
|
{ zentralwerk, lib, ... }:
|
||||||
# our custom options
|
# our custom options
|
||||||
{
|
{
|
||||||
options.deployment = with lib; {
|
options.deployment = with lib; {
|
||||||
|
@ -12,7 +12,14 @@
|
||||||
};
|
};
|
||||||
networks = mkOption {
|
networks = mkOption {
|
||||||
type = with types; listOf str;
|
type = with types; listOf str;
|
||||||
default = [ "serv" ];
|
default = builtins.attrNames (
|
||||||
|
lib.filterAttrs (net: { hosts4, hosts6, ... }:
|
||||||
|
hosts4 ? ${hostName} ||
|
||||||
|
lib.filterAttrs (ctx: hosts6:
|
||||||
|
hosts6 ? ${hostName}
|
||||||
|
) hosts6 != {}
|
||||||
|
) zentralwerk.lib.config.site.net
|
||||||
|
);
|
||||||
};
|
};
|
||||||
persistedShares = mkOption {
|
persistedShares = mkOption {
|
||||||
type = with types; listOf str;
|
type = with types; listOf str;
|
||||||
|
|
|
@ -8,17 +8,9 @@ let
|
||||||
flpk = "flpk-gw";
|
flpk = "flpk-gw";
|
||||||
};
|
};
|
||||||
|
|
||||||
nets = builtins.attrNames (
|
|
||||||
lib.filterAttrs (net: { hosts4, hosts6, ... }:
|
|
||||||
hosts4 ? ${hostName} ||
|
|
||||||
lib.filterAttrs (ctx: hosts6:
|
|
||||||
hosts6 ? ${hostName}
|
|
||||||
) hosts6 != {}
|
|
||||||
) zentralwerk.lib.config.site.net
|
|
||||||
);
|
|
||||||
|
|
||||||
inherit (config.networking) hostName;
|
inherit (config.networking) hostName;
|
||||||
inherit (config.system.build.skyflake-deployment) user repo vmName;
|
inherit (config.system.build.skyflake-deployment) user repo vmName;
|
||||||
|
inherit (config.deployment) networks;
|
||||||
|
|
||||||
generateMacAddress = net:
|
generateMacAddress = net:
|
||||||
let
|
let
|
||||||
|
@ -37,8 +29,6 @@ let
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
deployment.networks = nets;
|
|
||||||
|
|
||||||
microvm = {
|
microvm = {
|
||||||
hypervisor = "cloud-hypervisor";
|
hypervisor = "cloud-hypervisor";
|
||||||
vcpu = config.deployment.vcpu;
|
vcpu = config.deployment.vcpu;
|
||||||
|
@ -104,7 +94,7 @@ in
|
||||||
# rename interface to net name
|
# rename interface to net name
|
||||||
linkConfig.Name = net;
|
linkConfig.Name = net;
|
||||||
};
|
};
|
||||||
}) {} nets;
|
}) {} networks;
|
||||||
|
|
||||||
networks = builtins.foldl' (networks: net: networks // {
|
networks = builtins.foldl' (networks: net: networks // {
|
||||||
"30-${net}" =
|
"30-${net}" =
|
||||||
|
@ -135,6 +125,6 @@ builtins.filter (hosts6: hosts6 ? ${hostName}) (
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}) {} nets;
|
}) {} networks;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue