init k3s config
All checks were successful
/ check (push) Successful in 3m8s
/ deploy (push) Has been skipped

not finished but a pointer in the right direction
This commit is contained in:
Jermeiah S 2025-07-07 17:22:08 -04:00
parent 6c7781e325
commit 8a2acb343b
No known key found for this signature in database
3 changed files with 76 additions and 2 deletions

View file

@ -0,0 +1,45 @@
{
lib,
config,
pkgs,
...
}:
let
inherit (lib)
types
mkIf
mkOption
mkEnableOption
;
cfg = config.kub;
in
{
options.kub = {
enable = mkEnableOption "enable k3s";
role = mkOption {
type = types.enum [
"server"
"agent"
];
default = "agent";
};
leaderAddress = mkOption {
type = types.nullOr types.str;
default = null;
};
tokenFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
description = "File path containing k3s token to use when connecting to the server.";
default = config.sops.secrets.k3s-token.path or null;
};
};
config = mkIf cfg.enable {
sops.secrets.k3s-token = { };
services = {
k3s = {
enable = true;
clusterInit = mkIf (cfg.role == "server") true;
};
};
};
}