From acdd665b08c5b8890541f721c568d0ec2d51ba2e Mon Sep 17 00:00:00 2001 From: Serge Bazanski Date: Mon, 14 Dec 2020 19:10:50 +0100 Subject: [PATCH] cluster: use static addresses This disables DHCP on all k0 nodes. This change has been tentatively deployed to bc01n01 (which is cordoned off in kube), and I will deploy it to the rest of k0 machines once merged. Change-Id: I96253a9d0acedb4512c877c64174992ffdb43d58 --- cluster/nix/defs-machines.nix | 10 ++++++++++ cluster/nix/modules/base.nix | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cluster/nix/defs-machines.nix b/cluster/nix/defs-machines.nix index f68cc65a..4c50f679 100644 --- a/cluster/nix/defs-machines.nix +++ b/cluster/nix/defs-machines.nix @@ -4,6 +4,8 @@ threads = 16; fqdn = "${name}.hswaw.net"; ipAddr = "185.236.240.35"; + ipAddrBits = 28; + gw = "185.236.240.33"; podNet = "10.10.16.0/24"; diskBoot = "/dev/disk/by-id/scsi-360024e8078a9060023b1043107388af5"; fsRoot = "/dev/disk/by-uuid/518ecac1-00ea-4ef0-9418-9eca6ce6d918"; @@ -15,6 +17,8 @@ threads = 16; fqdn = "${name}.hswaw.net"; ipAddr = "185.236.240.36"; + ipAddrBits = 28; + gw = "185.236.240.33"; podNet = "10.10.17.0/24"; diskBoot = "/dev/disk/by-id/scsi-360024e8078b0250023b10f8706d3c99e"; fsRoot = "/dev/disk/by-uuid/2d45c87b-029b-463e-a7cb-afd5a3089327"; @@ -26,6 +30,8 @@ threads = 16; fqdn = "${name}.hswaw.net"; ipAddr = "185.236.240.37"; + ipAddrBits = 28; + gw = "185.236.240.33"; podNet = "10.10.18.0/24"; diskBoot = "/dev/disk/by-id/scsi-360024e8078a8fa0023b1787e0605a3e0"; fsRoot = "/dev/disk/by-uuid/afc05836-c9b3-4d7e-b0a2-3ebfe2336d4f"; @@ -37,6 +43,8 @@ threads = 48; fqdn = "${name}.hswaw.net"; ipAddr = "185.236.240.39"; + ipAddrBits = 28; + gw = "185.236.240.33"; podNet = "10.10.19.0/24"; diskBoot = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YJNX1M604518E"; fsRoot = "/dev/disk/by-uuid/b4149083-49fe-4951-a143-aff4cedaf33a"; @@ -48,6 +56,8 @@ threads = 48; fqdn = "${name}.hswaw.net"; ipAddr = "185.236.240.40"; + ipAddrBits = 28; + gw = "185.236.240.33"; podNet = "10.10.20.0/24"; diskBoot = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YJNF0M717009H"; fsRoot = "/dev/disk/by-uuid/fc5c6456-5bbd-4b9e-a93e-7f9073ffe09a"; diff --git a/cluster/nix/modules/base.nix b/cluster/nix/modules/base.nix index 84530c3a..034d1cd3 100644 --- a/cluster/nix/modules/base.nix +++ b/cluster/nix/modules/base.nix @@ -34,7 +34,16 @@ rec { programs.mtr.enable = true; networking.useDHCP = false; - networking.interfaces."${machine.mgmtIf}".useDHCP = true; + networking.interfaces."${machine.mgmtIf}" = { + ipv4.addresses = [ + { + address = machine.ipAddr; + prefixLength = machine.ipAddrBits; + } + ]; + }; + networking.defaultGateway = machine.gw; + networking.nameservers = ["185.236.240.1"]; # Instead of using nixpkgs from the root/nixos channel, use pkgs pin from this file. nix.nixPath = [ "nixpkgs=${pkgs.path}" "nixos-config=/etc/nixos/configuration.nix" ];