Add two new nodes to k2, taint master node

This commit is contained in:
Jonas Juselius
2021-09-22 21:13:36 +02:00
parent af39c22db2
commit 18de464e2f
6 changed files with 100 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.node;
cfg = config.features.k8s.host;
mkSANs = host: [
host.name
@@ -94,18 +94,6 @@ let
};
in {
options.node = {
address = mkOption {
type = types.str;
default = null;
};
name = mkOption {
type = types.str;
default = null;
};
};
config = configuration;
imports = [

View File

@@ -1,10 +1,29 @@
with import <nixpkgs> {};
let
etcdNodes = {
# k2-0 = "10.1.8.60";
# k2-1 = "10.1.8.61";
# k2-2 = "10.1.8.62";
};
master = {
node.name = "k2-0";
node.address = "10.1.8.60";
features.k8s.master.enable = true;
features.k8s.nodes = nodes;
features.k8s = {
host.name = "k2-0";
host.address = "10.1.8.60";
master.enable = true;
nodes = nodes;
etcdCluster = {
enable = false;
nodes = etcdNodes;
};
};
fileSystems = {
"/vol/local-storage/vol1" = {
device = "/vol/vol1";
options = [ "bind" ];
};
};
services.kubernetes.kubelet.unschedulable = true;
imports = [ ./cluster.nix ./hw/k2-0.nix ];
};
@@ -13,17 +32,30 @@ let
{ name = "k2-2"; address = "10.1.8.62"; }
{ name = "k2-3"; address = "10.1.8.63"; }
{ name = "k2-4"; address = "10.1.8.64"; }
{ name = "k2-5"; address = "10.1.8.65"; }
{ name = "k2-6"; address = "10.1.8.66"; }
];
mkNode = x: {
"${x.name}" = {
node.name = x.name;
node.address = x.address;
imports = [ ./cluster.nix (./hw + "/${x.name}.nix") ];
};
"${x.name}" =
lib.mkMerge [
{
features.k8s.host = x;
}
(if builtins.hasAttr x.name etcdNodes then
{
features.k8s.etcdCluster = {
enable = false;
existing = false;
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

27
clusters/k2/hw/k2-5.nix Normal file
View File

@@ -0,0 +1,27 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ ];
boot.initrd.availableKernelModules = [ "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/9e5acd6c-3e18-40c0-9826-a620812a7bff";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/255E-65E7";
fsType = "vfat";
};
swapDevices = [];
virtualisation.hypervGuest.enable = true;
}

27
clusters/k2/hw/k2-6.nix Normal file
View File

@@ -0,0 +1,27 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ ];
boot.initrd.availableKernelModules = [ "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/b34e8c50-665b-4a30-99cb-f845d2313cb8";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/51AC-7FD0";
fsType = "vfat";
};
swapDevices = [];
virtualisation.hypervGuest.enable = true;
}

View File

@@ -25,8 +25,7 @@ let
mkNode = x: {
"${x.name}" = { config, pkgs, ... }: {
deployment.tags = [ "node" ];
node.name = x.name;
node.address = x.address;
node = x;
imports = [ ./cluster.nix (./hw + "/${x.name}.nix") ];
};
};