Add toplevel module, and enable modules in config
This commit is contained in:
@@ -40,7 +40,7 @@ in {
|
||||
}
|
||||
];
|
||||
|
||||
imports = [ host.hw ./k8s.nix ];
|
||||
imports = [ host.hw ./modules.nix ];
|
||||
};
|
||||
|
||||
node = host: self: {
|
||||
@@ -57,7 +57,7 @@ in {
|
||||
}
|
||||
];
|
||||
|
||||
imports = [ host.hw ./k8s.nix ];
|
||||
imports = [ host.hw ./modules.nix ];
|
||||
};
|
||||
|
||||
mkDeployment = master: nodes:
|
||||
@@ -82,7 +82,7 @@ in {
|
||||
}
|
||||
];
|
||||
|
||||
imports = [ host.hw ./fs.nix ];
|
||||
imports = [ host.hw ./modules.nix ];
|
||||
};
|
||||
|
||||
mkDeployment = nodes:
|
||||
@@ -104,7 +104,7 @@ in {
|
||||
}
|
||||
];
|
||||
|
||||
imports = [ host.hw ./os.nix ];
|
||||
imports = [ host.hw ./modules.nix ];
|
||||
};
|
||||
|
||||
mkDeployment = masterNode: workerNodes:
|
||||
|
||||
@@ -42,6 +42,7 @@ let
|
||||
};
|
||||
in {
|
||||
options.cluster.fs = {
|
||||
enable = mkEnableOption "Enable nfs fileserver";
|
||||
nfs = {
|
||||
enable = mkEnableOption "Enable nfs fileserver";
|
||||
exports = mkOption {
|
||||
@@ -52,13 +53,13 @@ in {
|
||||
glusterfs.enable = mkEnableOption "Enable glusterfs fileserver";
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [
|
||||
common
|
||||
|
||||
(mkIf cfg.nfs.enable nfs)
|
||||
|
||||
(mkIf cfg.glusterfs.enable glusterfs)
|
||||
];
|
||||
]
|
||||
);
|
||||
|
||||
imports = [ ./os.nix ];
|
||||
}
|
||||
|
||||
11
lib/k8s.nix
11
lib/k8s.nix
@@ -204,6 +204,7 @@ let
|
||||
|
||||
in {
|
||||
options.cluster.k8s = {
|
||||
enable = mkEnableOption "Enable kubernetes";
|
||||
nodes = mkOption {
|
||||
type = types.listOf types.attrs;
|
||||
default = [];
|
||||
@@ -211,12 +212,12 @@ in {
|
||||
|
||||
fileserver = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
default = null;
|
||||
};
|
||||
|
||||
cidr = mkOption {
|
||||
type = types.str;
|
||||
default = "10.11.0.0/16";
|
||||
default = "10.0.0.0/16";
|
||||
};
|
||||
|
||||
master = {
|
||||
@@ -270,10 +271,12 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
config = mkIf cfg.k8s.enable (
|
||||
mkMerge [
|
||||
(mkIf cfg.k8s.master.enable kubeMaster)
|
||||
(mkIf cfg.k8s.node.enable kubeNode)
|
||||
];
|
||||
]
|
||||
);
|
||||
|
||||
imports = [ ./os.nix ];
|
||||
}
|
||||
|
||||
7
lib/modules.nix
Normal file
7
lib/modules.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
imports = [
|
||||
./os.nix
|
||||
./fs.nix
|
||||
./k8s.nix
|
||||
];
|
||||
}
|
||||
@@ -55,8 +55,8 @@ in
|
||||
|
||||
networking = {
|
||||
hostName = cfg.hostName;
|
||||
domain = cfg.domain;
|
||||
search = cfg.searchDomains;
|
||||
# domain = cfg.domain;
|
||||
# search = cfg.searchDomains;
|
||||
extraHosts = cfg.extraHosts;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user