Disable bootstrap_expect unless specific deuxfleurs.bootstrap is set

This commit is contained in:
Alex 2022-08-24 14:23:17 +02:00
parent 468c6b702b
commit ec2020b71b
Signed by untrusted user: lx
GPG key ID: 0E496D15096376BE

View file

@ -117,6 +117,11 @@ in
description = "List of users having an admin account on cluster nodes, maps user names to a list of authorized SSH keys"; description = "List of users having an admin account on cluster nodes, maps user names to a list of authorized SSH keys";
type = types.attrsOf (types.listOf types.str); type = types.attrsOf (types.listOf types.str);
}; };
bootstrap = mkOption {
description = "Whether to enable bootstrapping for Nomad and Consul";
type = types.bool;
default = false;
};
}; };
config = { config = {
@ -187,10 +192,8 @@ in
services.consul.enable = true; services.consul.enable = true;
services.consul.extraConfig = services.consul.extraConfig =
(if cfg.is_raft_server (if cfg.is_raft_server
then { then { server = true; }
server = true; // (if cfg.bootstrap then { bootstrap_expect = 3; } else {})
bootstrap_expect = 3;
}
else {}) // else {}) //
{ {
datacenter = cfg.cluster_name; datacenter = cfg.cluster_name;
@ -235,11 +238,10 @@ in
]; ];
services.nomad.settings = services.nomad.settings =
(if cfg.is_raft_server (if cfg.is_raft_server
then { server = { then {
enabled = true; server = { enabled = true; }
bootstrap_expect = 3; // (if cfg.bootstrap then { bootstrap_expect = 3; } else {});
}; } } else {}) //
else {}) //
{ {
region = cfg.cluster_name; region = cfg.cluster_name;
datacenter = cfg.site_name; datacenter = cfg.site_name;