modules/cluster: start supporting multiple storages

This commit is contained in:
Astro 2022-11-25 23:04:27 +01:00
parent 27d2252d11
commit ebf4e41b73
3 changed files with 16 additions and 1 deletions

View File

@ -44,6 +44,10 @@ in {
servers = servers; servers = servers;
# run tasks only on these: # run tasks only on these:
client.enable = builtins.elem hostName microvmServers; client.enable = builtins.elem hostName microvmServers;
client.meta =
lib.optionalAttrs (builtins.elem hostName storageServers) {
"c3d2.storage" = "big";
};
}; };
microvmUid = 997; microvmUid = 997;

View File

@ -18,5 +18,9 @@
type = with types; listOf str; type = with types; listOf str;
default = [ "/etc" "/home" "/var" ]; default = [ "/etc" "/home" "/var" ];
}; };
storage = mkOption {
type = types.enum [ "fast" "big" ];
default = "fast";
};
}; };
} }

View File

@ -59,7 +59,7 @@ in
tag = builtins.replaceStrings [ "/" ] [ "-" ] ( tag = builtins.replaceStrings [ "/" ] [ "-" ] (
withoutLeadingSlash mountPoint withoutLeadingSlash mountPoint
); );
source = "/glusterfs/fast/microvms/${user}/${repo}/${vmName}/${withoutLeadingSlash mountPoint}"; source = "/glusterfs/${config.deployment.storage}/microvms/${user}/${repo}/${vmName}/${withoutLeadingSlash mountPoint}";
inherit mountPoint; inherit mountPoint;
}) config.deployment.persistedShares; }) config.deployment.persistedShares;
volumes = [ { volumes = [ {
@ -76,6 +76,13 @@ in
}) config.deployment.networks; }) config.deployment.networks;
}; };
skyflake = {
nomadJob.constraints = lib.optionals (config.deployment.storage == "big") [ {
attribute = "\${meta.c3d2.storage}";
value = "big";
} ];
};
networking = { networking = {
useDHCP = false; useDHCP = false;
dhcpcd.enable = false; dhcpcd.enable = false;