this should be able to read the generated values from the controller
This commit is contained in:
parent
492e264c26
commit
3dc01cc803
1 changed files with 13 additions and 3 deletions
|
|
@ -1,6 +1,16 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, roles, ... }:
|
||||
let
|
||||
inherit (builtins) pathExists readFile;
|
||||
|
||||
controller = head (lib.attrNames roles.controller.machines or {});
|
||||
|
||||
# Read the controller's ip address
|
||||
ipAddressPath = "${config.clan.core.settings.directory}/vars/per-machine/${controller}/k3s-ip/ip_v4";
|
||||
ipAddress = if pathExists ipAddressPath then readFile ipAddressPath else null;
|
||||
|
||||
# Read the controller's token
|
||||
tokenPath = "${config.clan.core.settings.directory}/vars/per-machine/${controller}/k3s-token/token";
|
||||
token = if pathExists ipAddressPath then readFile ipAddressPath else null;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
|
|
@ -20,8 +30,8 @@ in
|
|||
k3s = {
|
||||
enable = true;
|
||||
role = "agent";
|
||||
token = "somehow get the token that is generated for the controller"; # config.clan.core.vars.generators.k3s-token.token.value;
|
||||
serverAddr = "https://<the ip address of the controller>";
|
||||
token = token;
|
||||
serverAddr = "https://${ipAddress}:6443";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue