aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/services/misc/mesos-slave.nix
diff options
context:
space:
mode:
authorCharles Strahan <charles@cstrahan.com>2016-12-28 00:19:51 -0500
committerCharles Strahan <charles@cstrahan.com>2016-12-29 20:09:46 -0500
commit7ebcada02028e5ce8199cc123fda6aa1aba72e64 (patch)
treefc4a4c2c31aeddf0625593ee5be48caa30741d4f /nixos/modules/services/misc/mesos-slave.nix
parentda70d3da0f11b22eac77756b39b349215e06b2e3 (diff)
mesos: 1.0.1 -> 1.1.0
Diffstat (limited to 'nixos/modules/services/misc/mesos-slave.nix')
-rw-r--r--nixos/modules/services/misc/mesos-slave.nix98
1 files changed, 94 insertions, 4 deletions
diff --git a/nixos/modules/services/misc/mesos-slave.nix b/nixos/modules/services/misc/mesos-slave.nix
index 9ddecb6fe30..47be10274d3 100644
--- a/nixos/modules/services/misc/mesos-slave.nix
+++ b/nixos/modules/services/misc/mesos-slave.nix
@@ -12,7 +12,23 @@ let
attribsArg = optionalString (cfg.attributes != {})
"--attributes=${mkAttributes cfg.attributes}";
- containerizers = [ "mesos" ] ++ (optional cfg.withDocker "docker");
+ containerizersArg = concatStringsSep "," (
+ lib.unique (
+ cfg.containerizers ++ (optional cfg.withDocker "docker")
+ )
+ );
+
+ imageProvidersArg = concatStringsSep "," (
+ lib.unique (
+ cfg.imageProviders ++ (optional cfg.withDocker "docker")
+ )
+ );
+
+ isolationArg = concatStringsSep "," (
+ lib.unique (
+ cfg.isolation ++ (optionals cfg.withDocker [ "filesystem/linux" "docker/runtime"])
+ )
+ );
in {
@@ -27,7 +43,7 @@ in {
ip = mkOption {
description = "IP address to listen on.";
default = "0.0.0.0";
- type = types.string;
+ type = types.str;
};
port = mkOption {
@@ -36,6 +52,53 @@ in {
type = types.int;
};
+ advertiseIp = mkOption {
+ description = "IP address advertised to reach this agent.";
+ default = null;
+ type = types.nullOr types.str;
+ };
+
+ advertisePort = mkOption {
+ description = "Port advertised to reach this agent.";
+ default = null;
+ type = types.nullOr types.int;
+ };
+
+ containerizers = mkOption {
+ description = ''
+ List of containerizer implementations to compose in order to provide
+ containerization. Available options are mesos and docker.
+ The order the containerizers are specified is the order they are tried.
+ '';
+ default = [ "mesos" ];
+ type = types.listOf types.str;
+ };
+
+ imageProviders = mkOption {
+ description = "List of supported image providers, e.g., APPC,DOCKER.";
+ default = [ ];
+ type = types.listOf types.str;
+ };
+
+ imageProvisionerBackend = mkOption {
+ description = ''
+ Strategy for provisioning container rootfs from images,
+ e.g., aufs, bind, copy, overlay.
+ '';
+ default = "copy";
+ type = types.str;
+ };
+
+ isolation = mkOption {
+ description = ''
+ Isolation mechanisms to use, e.g., posix/cpu,posix/mem, or
+ cgroups/cpu,cgroups/mem, or network/port_mapping, or `gpu/nvidia` for nvidia
+ specific gpu isolation.
+ '';
+ default = [ "posix/cpu" "posix/mem" ];
+ type = types.listOf types.str;
+ };
+
master = mkOption {
description = ''
May be one of:
@@ -57,6 +120,16 @@ in {
type = types.bool;
};
+ dockerRegistry = mkOption {
+ description = ''
+ The default url for pulling Docker images.
+ It could either be a Docker registry server url,
+ or a local path in which Docker image archives are stored.
+ '';
+ default = null;
+ type = types.nullOr (types.either types.str types.path);
+ };
+
workDir = mkOption {
description = "The Mesos work directory.";
default = "/var/lib/mesos/slave";
@@ -96,28 +169,45 @@ in {
host = "aabc123";
os = "nixos"; };
};
+
+ executorEnvironmentVariables = mkOption {
+ description = ''
+ The environment variables that should be passed to the executor, and thus subsequently task(s).
+ '';
+ default = {
+ PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
+ };
+ type = types.attrsOf types.str;
+ };
};
};
-
config = mkIf cfg.enable {
systemd.services.mesos-slave = {
description = "Mesos Slave";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
- environment.MESOS_CONTAINERIZERS = concatStringsSep "," containerizers;
+ path = [ pkgs.stdenv.shellPackage ];
serviceConfig = {
ExecStart = ''
${pkgs.mesos}/bin/mesos-slave \
+ --containerizers=${containerizersArg} \
+ --image_providers=${imageProvidersArg} \
+ --image_provisioner_backend=${cfg.imageProvisionerBackend} \
+ --isolation=${isolationArg} \
--ip=${cfg.ip} \
--port=${toString cfg.port} \
+ ${optionalString (cfg.advertiseIp != null) "--advertise_ip=${cfg.advertiseIp}"} \
+ ${optionalString (cfg.advertisePort != null) "--advertise_port=${toString cfg.advertisePort}"} \
--master=${cfg.master} \
--work_dir=${cfg.workDir} \
--logging_level=${cfg.logLevel} \
${attribsArg} \
${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
${optionalString cfg.withDocker "--docker=${pkgs.docker}/libexec/docker/docker"} \
+ ${optionalString (cfg.dockerRegistry != null) "--docker_registry=${cfg.dockerRegistry}"} \
+ --executor_environment_variables=${lib.escapeShellArg (builtins.toJSON cfg.executorEnvironmentVariables)} \
${toString cfg.extraCmdLineOptions}
'';
PermissionsStartOnly = true;