Refactor modules/features a bit
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.features.k8s.host;
|
cfg = config.features.host;
|
||||||
|
|
||||||
mkSANs = host: [
|
mkSANs = host: [
|
||||||
host.name
|
host.name
|
||||||
|
|||||||
@@ -15,10 +15,13 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
master = {
|
master = {
|
||||||
|
features.host = {
|
||||||
|
name = "k0-0";
|
||||||
|
address = "10.1.8.50";
|
||||||
|
};
|
||||||
features.k8s = {
|
features.k8s = {
|
||||||
host.name = "k0-0";
|
|
||||||
host.address = "10.1.8.50";
|
|
||||||
master.enable = true;
|
master.enable = true;
|
||||||
|
master.socat443 = true;
|
||||||
nodes = nodes;
|
nodes = nodes;
|
||||||
inherit etcdCluster;
|
inherit etcdCluster;
|
||||||
};
|
};
|
||||||
@@ -34,7 +37,7 @@ let
|
|||||||
"${x.name}" =
|
"${x.name}" =
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
features.k8s.host = x;
|
features.host = x;
|
||||||
}
|
}
|
||||||
(if builtins.hasAttr x.name etcdNodes then
|
(if builtins.hasAttr x.name etcdNodes then
|
||||||
{
|
{
|
||||||
@@ -47,5 +50,5 @@ let
|
|||||||
|
|
||||||
in
|
in
|
||||||
builtins.foldl' (a: x: a // mkNode x) {
|
builtins.foldl' (a: x: a // mkNode x) {
|
||||||
"${master.features.k8s.host.name}" = master;
|
"${master.features.host.name}" = master;
|
||||||
} nodes
|
} nodes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.features.k8s.host;
|
cfg = config.features.host;
|
||||||
|
|
||||||
mkSANs = host: [
|
mkSANs = host: [
|
||||||
host.name
|
host.name
|
||||||
@@ -96,6 +96,16 @@ let
|
|||||||
address = cfg.address;
|
address = cfg.address;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileSystems = {
|
||||||
|
"/vol/local-storage/vol1" = {
|
||||||
|
device = "/vol/vol1";
|
||||||
|
options = [ "bind" ];
|
||||||
|
};
|
||||||
|
"/vol/local-storage/vol2" = {
|
||||||
|
device = "/vol/vol2";
|
||||||
|
options = [ "bind" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
config = configuration;
|
config = configuration;
|
||||||
|
|||||||
@@ -13,19 +13,18 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
master = {
|
master = {
|
||||||
|
features.host = {
|
||||||
|
name = "k1-0";
|
||||||
|
address = "10.1.30.100";
|
||||||
|
};
|
||||||
features.k8s = {
|
features.k8s = {
|
||||||
host.name = "k1-0";
|
host.name = "k1-0";
|
||||||
host.address = "10.1.30.100";
|
host.address = "10.1.30.100";
|
||||||
master.enable = true;
|
master.enable = true;
|
||||||
|
master.socat443 = true;
|
||||||
nodes = nodes;
|
nodes = nodes;
|
||||||
inherit etcdCluster;
|
inherit etcdCluster;
|
||||||
};
|
};
|
||||||
fileSystems = {
|
|
||||||
"/vol/local-storage/vol1" = {
|
|
||||||
device = "/vol/vol1";
|
|
||||||
options = [ "bind" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
imports = [ ./cluster.nix ./hw/k1-0.nix ];
|
imports = [ ./cluster.nix ./hw/k1-0.nix ];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ let
|
|||||||
"${x.name}" =
|
"${x.name}" =
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
features.k8s.host = x;
|
features.host = x;
|
||||||
}
|
}
|
||||||
(if builtins.hasAttr x.name etcdNodes then
|
(if builtins.hasAttr x.name etcdNodes then
|
||||||
{
|
{
|
||||||
@@ -54,6 +53,6 @@ let
|
|||||||
|
|
||||||
in
|
in
|
||||||
builtins.foldl' (a: x: a // mkNode x) {
|
builtins.foldl' (a: x: a // mkNode x) {
|
||||||
"${master.features.k8s.host.name}" = master;
|
"${master.features.host.name}" = master;
|
||||||
} nodes
|
} nodes
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.features.k8s.host;
|
cfg = config.features.host;
|
||||||
|
|
||||||
mkSANs = host: [
|
mkSANs = host: [
|
||||||
host.name
|
host.name
|
||||||
@@ -71,6 +71,17 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileSystems = {
|
||||||
|
"/vol/local-storage/vol1" = {
|
||||||
|
device = "/vol/vol1";
|
||||||
|
options = [ "bind" ];
|
||||||
|
};
|
||||||
|
"/vol/local-storage/vol2" = {
|
||||||
|
device = "/vol/vol2";
|
||||||
|
options = [ "bind" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = cfg.name;
|
hostName = cfg.name;
|
||||||
domain = "itpartner.intern";
|
domain = "itpartner.intern";
|
||||||
|
|||||||
@@ -13,19 +13,16 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
master = {
|
master = {
|
||||||
|
features.host = {
|
||||||
|
name = "k2-0";
|
||||||
|
address = "10.1.8.60";
|
||||||
|
};
|
||||||
features.k8s = {
|
features.k8s = {
|
||||||
host.name = "k2-0";
|
|
||||||
host.address = "10.1.8.60";
|
|
||||||
master.enable = true;
|
master.enable = true;
|
||||||
|
master.socat443 = true;
|
||||||
nodes = nodes;
|
nodes = nodes;
|
||||||
inherit etcdCluster;
|
inherit etcdCluster;
|
||||||
};
|
};
|
||||||
fileSystems = {
|
|
||||||
"/vol/local-storage/vol1" = {
|
|
||||||
device = "/vol/vol1";
|
|
||||||
options = [ "bind" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
imports = [ ./cluster.nix ./hw/k2-0.nix ];
|
imports = [ ./cluster.nix ./hw/k2-0.nix ];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,7 +39,7 @@ let
|
|||||||
"${x.name}" =
|
"${x.name}" =
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
features.k8s.host = x;
|
features.host = x;
|
||||||
}
|
}
|
||||||
(if builtins.hasAttr x.name etcdNodes then
|
(if builtins.hasAttr x.name etcdNodes then
|
||||||
{
|
{
|
||||||
@@ -63,5 +60,5 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
builtins.foldl' (a: x: a // mkNode x) {
|
builtins.foldl' (a: x: a // mkNode x) {
|
||||||
"${master.features.k8s.host.name}" = master;
|
"${master.features.host.name}" = master;
|
||||||
} nodes
|
} nodes
|
||||||
|
|||||||
Reference in New Issue
Block a user