modules/microvm: c3d2.deployment.server = "nomad"

This commit is contained in:
Astro 2022-07-10 20:50:07 +02:00
parent 497ef03b3c
commit 1b618f0cd8
3 changed files with 18 additions and 3 deletions

View File

@ -9,6 +9,7 @@ in
};
c3d2.deployment = {
server = "nomad";
mounts = [ "etc" "home" "var"];
mountBase = "/glusterfs/fast/microvms/${config.networking.hostName}";
};

View File

@ -2,7 +2,7 @@
{
c3d2.deployment = {
server = "server10";
server = "nomad";
mounts = [];
mountBase = "/glusterfs/fast/microvms/${config.networking.hostName}";
};

View File

@ -29,9 +29,12 @@ in
{
options.c3d2.deployment = with lib; {
server = mkOption {
type = with types; nullOr (enum [ "server9" "server10" ]);
type = types.enum [ "server9" "server10" "nomad" ];
default = null;
description = "Server that is supposed to host this MicroVM.";
description = ''
Server that is supposed to host this MicroVM,
or \"nomad\" for HA clustering.
'';
};
autoNetSetup = mkOption {
@ -58,6 +61,17 @@ in
};
};
config.assertions = [ {
assertion =
config.c3d2.deployment.server == "nomad" ->
config.c3d2.deployment.mounts == [] ||
lib.hasPrefix "/glusterfs" config.c3d2.deployment.mountBase;
message = ''
Host \"${config.networking.hostName}\" is to be run on nomad
but its mountBase is not located on /glusterfs/...!
'';
} ];
config.system.build = with pkgs; {
copyToServer = writeScript "copy-to-${server}" ''
#! ${runtimeShell} -e