Do not import kubernets node labels from nixos-servers
This commit is contained in:
parent
e18f3c7caa
commit
7be57d26f0
4 changed files with 157 additions and 23 deletions
150
flake.lock
150
flake.lock
|
@ -158,6 +158,22 @@
|
|||
}
|
||||
},
|
||||
"flake-compat_4": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_5": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
|
@ -173,7 +189,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_5": {
|
||||
"flake-compat_6": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
|
@ -335,6 +351,30 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks_2": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_4",
|
||||
"gitignore": "gitignore_2",
|
||||
"nixpkgs": [
|
||||
"servers",
|
||||
"nixpkgs-unstable"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730302582,
|
||||
"narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -356,6 +396,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"servers",
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"haumea": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -403,7 +465,7 @@
|
|||
},
|
||||
"kubenix_2": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_4",
|
||||
"flake-compat": "flake-compat_5",
|
||||
"nixpkgs": [
|
||||
"servers",
|
||||
"nixpkgs-unstable"
|
||||
|
@ -480,7 +542,7 @@
|
|||
},
|
||||
"nix-snapshotter": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_5",
|
||||
"flake-compat": "flake-compat_6",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": [
|
||||
"servers",
|
||||
|
@ -568,6 +630,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-facter-modules": {
|
||||
"locked": {
|
||||
"lastModified": 1730737399,
|
||||
"narHash": "sha256-PzJrTMhHb9f46uMxmRD4GjnyVuNqxeyEvxaq7OierUQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "nixos-facter-modules",
|
||||
"rev": "c22b916f629fee6941a2976c62247b0bec68082b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "nixos-facter-modules",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1729742320,
|
||||
|
@ -617,6 +694,22 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs-stable_2": {
|
||||
"locked": {
|
||||
"lastModified": 1720386169,
|
||||
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable_3": {
|
||||
"locked": {
|
||||
"lastModified": 1729357638,
|
||||
"narHash": "sha256-66RHecx+zohbZwJVEPF7uuwHeqf8rykZTMCTqIrOew4=",
|
||||
|
@ -696,6 +789,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1726871744,
|
||||
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"poetry2nix": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_4",
|
||||
|
@ -732,7 +841,7 @@
|
|||
"nixng": "nixng",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"servers": "servers",
|
||||
"treefmt-nix": "treefmt-nix_3"
|
||||
"treefmt-nix": "treefmt-nix_4"
|
||||
}
|
||||
},
|
||||
"servers": {
|
||||
|
@ -741,22 +850,25 @@
|
|||
"disko": "disko",
|
||||
"dns": "dns_2",
|
||||
"flake-utils": "flake-utils_6",
|
||||
"git-hooks": "git-hooks_2",
|
||||
"kubenix": "kubenix_2",
|
||||
"nix-snapshotter": "nix-snapshotter",
|
||||
"nixng": "nixng_2",
|
||||
"nixos-facter-modules": "nixos-facter-modules",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"sops-nix": "sops-nix"
|
||||
"sops-nix": "sops-nix",
|
||||
"treefmt-nix": "treefmt-nix_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729864092,
|
||||
"narHash": "sha256-8AL1TTUYu6KxcT2C9NNlvAtZvYoaniNqkTibSW9aIh0=",
|
||||
"lastModified": 1730757386,
|
||||
"narHash": "sha256-oJOJrj38CS1lSxYHdU5x/ect9TVu9J/DRDJ/o+zQv/8=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "2352a1a9177fbb7d3fed042cc74f80e079196020",
|
||||
"revCount": 477,
|
||||
"rev": "ed550eafb115c78def25f2c88b54ce3f70daa6a6",
|
||||
"revCount": 489,
|
||||
"type": "git",
|
||||
"url": "https://git.kun.is/home/nixos-servers"
|
||||
},
|
||||
|
@ -771,7 +883,7 @@
|
|||
"servers",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable_2"
|
||||
"nixpkgs-stable": "nixpkgs-stable_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729775275,
|
||||
|
@ -969,6 +1081,24 @@
|
|||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730025913,
|
||||
"narHash": "sha256-Y9NtFmP8ciLyRsopcCx1tyoaaStKeq+EndwtGCgww7I=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "bae131e525cc8718da22fbeb8d8c7c43c4ea502a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix_4": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_5"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730120726,
|
||||
"narHash": "sha256-LqHYIxMrl/1p3/kvm2ir925tZ8DkI0KA10djk8wecSk=",
|
||||
|
|
10
globals.nix
10
globals.nix
|
@ -32,6 +32,16 @@
|
|||
hedgedoc = "quay.io/hedgedoc/hedgedoc:1.10.0";
|
||||
minecraft = "itzg/minecraft-server:latest";
|
||||
};
|
||||
|
||||
nodeLabels = {
|
||||
atlas.storageType = "slow";
|
||||
jefke.storageType = "fast";
|
||||
|
||||
lewis = {
|
||||
storageType = "fast";
|
||||
hasMedia = "true";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
globals = globals // servers.globals;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
inputs @ {
|
||||
self,
|
||||
servers,
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
kubenix,
|
||||
|
@ -14,12 +13,10 @@ flake-utils.lib.eachDefaultSystem
|
|||
buildCommand = "${old.buildCommand}\npatchShebangs $out";
|
||||
});
|
||||
|
||||
machines = servers.machines.${system};
|
||||
|
||||
mkKubernetes = name: module: namespace:
|
||||
(kubenix.evalModules.${system} {
|
||||
specialArgs = {
|
||||
inherit namespace system machines self;
|
||||
inherit namespace system self;
|
||||
inherit (inputs) nixhelm blog-pim dns nixpkgs nixng;
|
||||
inherit (self) globals;
|
||||
|
||||
|
@ -74,8 +71,8 @@ flake-utils.lib.eachDefaultSystem
|
|||
|
||||
postBuild = let
|
||||
# HACK: create normal way of checking if server runs k8s
|
||||
k8sMachines = lib.filterAttrs (n: m: m.kubernetesNodeLabels != null) machines;
|
||||
k8sServerNames = builtins.concatStringsSep " " (builtins.attrNames k8sMachines);
|
||||
k8sMachines = builtins.attrNames self.globals.nodeLabels;
|
||||
k8sServerNames = builtins.concatStringsSep " " k8sMachines;
|
||||
in
|
||||
/*
|
||||
bash
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
nixhelm,
|
||||
system,
|
||||
globals,
|
||||
machines,
|
||||
...
|
||||
}: {
|
||||
options.bootstrap-default.enable = lib.mkEnableOption "bootstrap-default";
|
||||
|
@ -65,14 +64,12 @@
|
|||
ntfy = {};
|
||||
};
|
||||
|
||||
nodes = let
|
||||
machinesWithKubernetesLabels = lib.filterAttrs (name: machine: machine.kubernetesNodeLabels != null) machines;
|
||||
in
|
||||
nodes =
|
||||
builtins.mapAttrs
|
||||
(name: machine: {
|
||||
metadata.labels = machine.kubernetesNodeLabels;
|
||||
(name: labels: {
|
||||
metadata.labels = labels;
|
||||
})
|
||||
machinesWithKubernetesLabels;
|
||||
globals.nodeLabels;
|
||||
|
||||
recurringJobs.backup-nfs.spec = {
|
||||
cron = "0 1 * * *"; # One o'clock at night
|
||||
|
|
Loading…
Reference in a new issue