Update k0 to multi etcd
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
# Pin the deployment package-set to a specific version of nixpkgs
|
||||
# with import <nixpkgs> {};
|
||||
with import ../nixos-21.05.nix {};
|
||||
# with import ../nixos-21.05.nix {};
|
||||
with import <nixpkgs> {};
|
||||
let
|
||||
etcdNodes = {
|
||||
k0-0 = "10.1.8.50";
|
||||
k0-1 = "10.1.8.51";
|
||||
k0-2 = "10.1.8.52";
|
||||
};
|
||||
|
||||
master = {
|
||||
node.name = "k0-0";
|
||||
node.address = "10.1.8.50";
|
||||
features.k8s.master.enable = true;
|
||||
features.k8s.nodes = nodes;
|
||||
features.k8s = {
|
||||
host.name = "k0-0";
|
||||
host.address = "10.1.8.50";
|
||||
master.enable = true;
|
||||
nodes = nodes;
|
||||
etcdCluster = {
|
||||
enable = true;
|
||||
existing = true;
|
||||
nodes = etcdNodes;
|
||||
};
|
||||
};
|
||||
services.kubernetes.kubelet.unschedulable = true;
|
||||
imports = [ ./cluster.nix ./hw/k0-0.nix ];
|
||||
};
|
||||
@@ -19,13 +31,24 @@ let
|
||||
|
||||
mkNode = x: {
|
||||
"${x.name}" =
|
||||
lib.mkMerge [
|
||||
{
|
||||
node = x;
|
||||
imports = [ ./cluster.nix (./hw + "/${x.name}.nix") ];
|
||||
};
|
||||
features.k8s.host = x;
|
||||
}
|
||||
(if builtins.hasAttr x.name etcdNodes then
|
||||
{
|
||||
features.k8s.etcdCluster = {
|
||||
enable = true;
|
||||
existing = true;
|
||||
nodes = etcdNodes;
|
||||
};
|
||||
}
|
||||
else {})
|
||||
]
|
||||
// { imports = [ ./cluster.nix (./hw + "/${x.name}.nix") ]; };
|
||||
};
|
||||
|
||||
in
|
||||
builtins.foldl' (a: x: a // mkNode x) {
|
||||
"${master.node.name}" = master;
|
||||
"${master.features.k8s.host.name}" = master;
|
||||
} nodes
|
||||
|
||||
Reference in New Issue
Block a user