Compare commits
No commits in common. "f4cd66b8d97f039eb6393e4e0be0023c2c919175" and "60777a578ff0bcf9bf0195eb296abedd2d9a8c95" have entirely different histories.
f4cd66b8d9
...
60777a578f
12 changed files with 5 additions and 176 deletions
1
.envrc
1
.envrc
|
@ -1 +0,0 @@
|
||||||
use flake
|
|
24
flake.nix
24
flake.nix
|
@ -31,31 +31,13 @@
|
||||||
bootstrap = kclib.mkHost {
|
bootstrap = kclib.mkHost {
|
||||||
name = "bootstrap";
|
name = "bootstrap";
|
||||||
};
|
};
|
||||||
|
etcd0 = kclib.mkHost {
|
||||||
|
name = "etcd0";
|
||||||
|
};
|
||||||
hydra = kclib.mkHost {
|
hydra = kclib.mkHost {
|
||||||
name = "hydra";
|
name = "hydra";
|
||||||
};
|
};
|
||||||
node0 = kclib.mkHost {
|
|
||||||
name = "node0";
|
|
||||||
};
|
|
||||||
node1 = kclib.mkHost {
|
|
||||||
name = "node1";
|
|
||||||
};
|
|
||||||
node2 = kclib.mkHost {
|
|
||||||
name = "node2";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
||||||
devShells.x86_64-linux.default =
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
allowUnfree = true;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
pkgs.mkShellNoCC {
|
|
||||||
packages = with pkgs; [
|
|
||||||
cfssl
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
kropcloud =
|
|
||||||
let
|
|
||||||
serverIp = "192.168.1.170";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
services = {
|
|
||||||
k3s = {
|
|
||||||
enable = true;
|
|
||||||
isMaster = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
networking = {
|
|
||||||
ipv4 = {
|
|
||||||
address = serverIp;
|
|
||||||
prefixLength = 24;
|
|
||||||
defaultGateway = "192.168.1.1";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
kropcloud =
|
|
||||||
let
|
|
||||||
serverIp = "192.168.1.171";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
services = {
|
|
||||||
k3s = {
|
|
||||||
enable = true;
|
|
||||||
master = "node0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
networking = {
|
|
||||||
ipv4 = {
|
|
||||||
address = serverIp;
|
|
||||||
prefixLength = 24;
|
|
||||||
defaultGateway = "192.168.1.1";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
kropcloud =
|
|
||||||
let
|
|
||||||
serverIp = "192.168.1.172";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
services = {
|
|
||||||
k3s = {
|
|
||||||
enable = true;
|
|
||||||
master = "node0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
networking = {
|
|
||||||
ipv4 = {
|
|
||||||
address = serverIp;
|
|
||||||
prefixLength = 24;
|
|
||||||
defaultGateway = "192.168.1.1";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
13
lib.nix
13
lib.nix
|
@ -6,13 +6,12 @@
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
arch ? "x86_64-linux",
|
arch ? "x86_64-linux",
|
||||||
config_name ? name,
|
|
||||||
}:
|
}:
|
||||||
inputs.nixpkgs.lib.nixosSystem {
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
system = arch;
|
system = arch;
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/base
|
./hosts/base
|
||||||
./hosts/${config_name}
|
./hosts/${name}
|
||||||
./nixosModules
|
./nixosModules
|
||||||
(
|
(
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
@ -29,14 +28,4 @@
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# TODO: this will actually be nice, so I can see IPs in main flake.nix,
|
|
||||||
# but also dont have three directories with only default.nix in it
|
|
||||||
# mkK3Snode = {
|
|
||||||
# name_prefix,
|
|
||||||
# id,
|
|
||||||
# ip
|
|
||||||
# }: mkHost {
|
|
||||||
# name = "${name_prefix}-${id}";
|
|
||||||
# config_name = "k3snode";
|
|
||||||
# };
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,6 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
services.avahi = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
nftables.enable = true;
|
nftables.enable = true;
|
||||||
firewall = {
|
firewall = {
|
||||||
|
|
|
@ -4,6 +4,5 @@
|
||||||
./ssh
|
./ssh
|
||||||
./tailscale
|
./tailscale
|
||||||
./hydra
|
./hydra
|
||||||
./k3s
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cfg = config.kropcloud.services.k3s;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.kropcloud.services.k3s = {
|
|
||||||
enable = lib.mkEnableOption "Whence to enable k3s service.";
|
|
||||||
isMaster = lib.mkEnableOption "Whence to configure k3s as master.";
|
|
||||||
master = lib.mkOption {
|
|
||||||
type = with lib.types; nullOr str;
|
|
||||||
default = null;
|
|
||||||
example = "node0";
|
|
||||||
description = "The master node to connect to";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
|
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = (!cfg.isMaster && cfg.master == null);
|
|
||||||
message = ''
|
|
||||||
You need to provide a valid value for `master` in `kropcloud.services.k3s`
|
|
||||||
when `isMaster` is not set.
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
age.secrets.k3stoken.file = ../../../secrets/k3stoken.age;
|
|
||||||
|
|
||||||
services.k3s = {
|
|
||||||
enable = true;
|
|
||||||
role = "server";
|
|
||||||
tokenFile = config.age.secrets.k3stoken.path;
|
|
||||||
extraFlags = toString (
|
|
||||||
[
|
|
||||||
"--write-kubeconfig-mode \"0644\""
|
|
||||||
"--cluster-init"
|
|
||||||
"--disable servicelb"
|
|
||||||
"--disable traefik"
|
|
||||||
"--disable local-storage"
|
|
||||||
]
|
|
||||||
++ (
|
|
||||||
if cfg.isMaster && cfg.master != null then
|
|
||||||
[ ]
|
|
||||||
else
|
|
||||||
[
|
|
||||||
"--server https://${cfg.master}:6443"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
clusterInit = cfg.isMaster;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
age-encryption.org/v1
|
|
||||||
-> ssh-ed25519 5k28aQ wUKJk8gcxcCqbdXsfuod3dvEtj+pXRe8rLYVv/uyND4
|
|
||||||
aHOXSUwP5+AJZ5etU+dj9ssVNQNcDuXSpq+wvIYsoyE
|
|
||||||
-> ssh-ed25519 MhDGlw Ln5f8TTQFDlp+KGQpRRPNgn/+fzoY7Bnl7FlDg5ZSSs
|
|
||||||
uJbxZFjjcSxhIPHvregG1tD8BKKfHHMlvfZ6itDIppY
|
|
||||||
--- MGApTU7O6xSlpanV9LC22ZX2u7bwULpBMaTLg01SO/0
|
|
||||||
šâYøï ö¯J#<23>ž6/ó—6 ñwTF¯ìfŒÔ¶¡ x×<78>º™5·Îÿ¸^
|
|
|
@ -11,10 +11,6 @@
|
||||||
"hosts:wenar-nix",
|
"hosts:wenar-nix",
|
||||||
"hosts:lenar",
|
"hosts:lenar",
|
||||||
"servers:test-server"
|
"servers:test-server"
|
||||||
],
|
|
||||||
"k3stoken.age": [
|
|
||||||
"hosts:wenar-nix",
|
|
||||||
"hosts:lenar"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,5 +9,4 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
"mypassword.age".publicKeys = getKeys "mypassword.age";
|
"mypassword.age".publicKeys = getKeys "mypassword.age";
|
||||||
"k3stoken.age".publicKeys = getKeys "k3stoken.age";
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue