modules/cluster/deployment: add option extraShares

This commit is contained in:
Astro 2022-12-12 21:16:20 +01:00
parent 592d79a9e0
commit 49b6b5dc4d
2 changed files with 40 additions and 13 deletions

View File

@ -42,6 +42,22 @@
Which glusterfs volume to use for persistedShares
'';
};
extraShares = mkOption {
type = with types; listOf (submodule {
options = {
source = mkOption {
type = str;
};
mountPoint = mkOption {
type = str;
};
};
});
default = [];
description = ''
Extra shares. THESE MUST BE AVAILABLE ON ALL MICROVM HOSTS!
'';
};
needForSpeed = mkOption {
type = types.bool;
default = false;

View File

@ -37,19 +37,30 @@ in
rm -f "${writableStoreOverlayImage}"
'';
shares = [ {
proto = "virtiofs";
tag = "ro-store";
source = "/nix/store";
mountPoint = "/nix/.ro-store";
} ] ++ map (mountPoint: {
proto = "virtiofs";
tag = builtins.replaceStrings [ "/" ] [ "-" ] (
withoutLeadingSlash mountPoint
);
source = "/glusterfs/${config.deployment.storage}/microvms/${user}/${repo}/${vmName}/${withoutLeadingSlash mountPoint}";
inherit mountPoint;
}) config.deployment.persistedShares;
shares =
[ {
proto = "virtiofs";
tag = "ro-store";
source = "/nix/store";
mountPoint = "/nix/.ro-store";
} ]
++
map (mountPoint: {
proto = "virtiofs";
tag = builtins.replaceStrings [ "/" ] [ "-" ] (
withoutLeadingSlash mountPoint
);
source = "/glusterfs/${config.deployment.storage}/microvms/${user}/${repo}/${vmName}/${withoutLeadingSlash mountPoint}";
inherit mountPoint;
}) config.deployment.persistedShares
++
map ({ source, mountPoint }: {
proto = "virtiofs";
tag = builtins.replaceStrings [ "/" ] [ "-" ] (
withoutLeadingSlash mountPoint
);
inherit mountPoint source;
}) config.deployment.extraShares;
volumes = [ {
image = writableStoreOverlayImage;
mountPoint = config.microvm.writableStoreOverlay;