photoncloud-monorepo/nix/nodes/vm-cluster/cluster.nix

129 lines
3.5 KiB
Nix

{ ... }:
{
plasmacloud.cluster = {
enable = true;
name = "plasmacloud-vm-cluster";
nodes = {
node01 = {
role = "control-plane";
ip = "192.168.100.11";
services = [ "chainfire" "flaredb" "iam" ];
labels = {
tier = "control-plane";
platform = "vm-cluster";
};
pool = "control";
nodeClass = "control-plane";
failureDomain = "rack-a";
nixProfile = "profiles/control-plane";
installPlan = {
nixosConfiguration = "node01";
diskoConfigPath = "nix/nodes/vm-cluster/node01/disko.nix";
targetDisk = "/dev/vda";
};
desiredSystem = {
healthCheckCommand = [ "systemctl" "is-system-running" "--wait" ];
rollbackOnFailure = true;
};
raftPort = 2380;
apiPort = 2379;
};
node02 = {
role = "control-plane";
ip = "192.168.100.12";
services = [ "chainfire" "flaredb" "iam" ];
labels = {
tier = "control-plane";
platform = "vm-cluster";
};
pool = "control";
nodeClass = "control-plane";
failureDomain = "rack-b";
nixProfile = "profiles/control-plane";
installPlan = {
nixosConfiguration = "node02";
diskoConfigPath = "nix/nodes/vm-cluster/node02/disko.nix";
targetDisk = "/dev/vda";
};
desiredSystem = {
healthCheckCommand = [ "systemctl" "is-system-running" "--wait" ];
rollbackOnFailure = true;
};
raftPort = 2380;
apiPort = 2379;
};
node03 = {
role = "control-plane";
ip = "192.168.100.13";
services = [ "chainfire" "flaredb" "iam" ];
labels = {
tier = "control-plane";
platform = "vm-cluster";
};
pool = "control";
nodeClass = "control-plane";
failureDomain = "rack-c";
nixProfile = "profiles/control-plane";
installPlan = {
nixosConfiguration = "node03";
diskoConfigPath = "nix/nodes/vm-cluster/node03/disko.nix";
targetDisk = "/dev/vda";
};
desiredSystem = {
healthCheckCommand = [ "systemctl" "is-system-running" "--wait" ];
rollbackOnFailure = true;
};
raftPort = 2380;
apiPort = 2379;
};
};
deployer = {
clusterId = "plasmacloud-vm-cluster";
environment = "dev";
nodeClasses = {
control-plane = {
description = "Control-plane VM cluster nodes";
nixProfile = "profiles/control-plane";
roles = [ "control-plane" ];
labels = {
tier = "control-plane";
platform = "vm-cluster";
};
};
};
pools = {
control = {
description = "VM cluster control-plane pool";
nodeClass = "control-plane";
labels = {
plane = "control";
cluster = "vm-cluster";
};
};
};
hostDeployments = {
control-plane-canary = {
selector.nodeIds = [ "node01" ];
nixosConfiguration = "node01";
flakeRef = "github:centra/cloud";
batchSize = 1;
maxUnavailable = 1;
healthCheckCommand = [ "systemctl" "is-system-running" "--wait" ];
switchAction = "switch";
rollbackOnFailure = true;
};
};
};
bootstrap.initialPeers = [ "node01" "node02" "node03" ];
bgp.asn = 64512;
};
}