mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-13 08:30:05 +01:00
fix(testing): e2e testing fixes
This commit is contained in:
parent
3549610e0e
commit
b43748a3a5
1 changed files with 41 additions and 41 deletions
|
|
@ -29,49 +29,49 @@ let
|
||||||
in nixosTesting.makeTest {
|
in nixosTesting.makeTest {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
|
||||||
nodes = mapAttrs (machineName: machine:
|
nodes = mapAttrs (machineName: machine: { config, pkgs, lib, nodes, ... }: {
|
||||||
{ config, pkgs, lib, nodes, ... }:
|
imports = [<nixpkgs/nixos/modules/profiles/minimal.nix>];
|
||||||
mkMerge [
|
|
||||||
{
|
|
||||||
boot.postBootCommands = "rm -fr /var/lib/kubernetes/secrets /tmp/shared/*";
|
|
||||||
virtualisation.memorySize = mkDefault 1536;
|
|
||||||
virtualisation.diskSize = mkDefault 4096;
|
|
||||||
networking = {
|
|
||||||
inherit domain extraHosts;
|
|
||||||
primaryIPAddress = mkForce machine.ip;
|
|
||||||
|
|
||||||
firewall = {
|
config = mkMerge [{
|
||||||
allowedTCPPorts = [
|
virtualisation.cores = "all";
|
||||||
10250 # kubelet
|
boot.postBootCommands = "rm -fr /var/lib/kubernetes/secrets /tmp/shared/*";
|
||||||
];
|
virtualisation.memorySize = mkDefault 1536;
|
||||||
trustedInterfaces = ["docker0"];
|
virtualisation.diskSize = mkDefault 4096;
|
||||||
|
networking = {
|
||||||
|
inherit domain extraHosts;
|
||||||
|
primaryIPAddress = mkForce machine.ip;
|
||||||
|
|
||||||
extraCommands = concatMapStrings (node: ''
|
firewall = {
|
||||||
iptables -A INPUT -s ${node.config.networking.primaryIPAddress} -j ACCEPT
|
allowedTCPPorts = [
|
||||||
'') (attrValues nodes);
|
10250 # kubelet
|
||||||
};
|
|
||||||
};
|
|
||||||
environment.systemPackages = [ kubectl ];
|
|
||||||
services.flannel.iface = "eth1";
|
|
||||||
services.kubernetes = {
|
|
||||||
easyCerts = true;
|
|
||||||
inherit (machine) roles;
|
|
||||||
apiserver = {
|
|
||||||
securePort = 443;
|
|
||||||
advertiseAddress = master.ip;
|
|
||||||
};
|
|
||||||
masterAddress = "${masterName}.${config.networking.domain}";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
(optionalAttrs (any (role: role == "master") machine.roles) {
|
|
||||||
networking.firewall.allowedTCPPorts = [
|
|
||||||
443 # kubernetes apiserver
|
|
||||||
];
|
];
|
||||||
})
|
trustedInterfaces = ["docker0"];
|
||||||
(optionalAttrs (machine ? "extraConfiguration") (machine.extraConfiguration { inherit config pkgs lib nodes; }))
|
|
||||||
(optionalAttrs (extraConfiguration != null) (extraConfiguration { inherit config pkgs lib nodes; }))
|
extraCommands = concatMapStrings (node: ''
|
||||||
]
|
iptables -A INPUT -s ${node.config.networking.primaryIPAddress} -j ACCEPT
|
||||||
) machines;
|
'') (attrValues nodes);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
environment.systemPackages = [ kubectl ];
|
||||||
|
services.flannel.iface = "eth1";
|
||||||
|
services.kubernetes = {
|
||||||
|
easyCerts = true;
|
||||||
|
inherit (machine) roles;
|
||||||
|
apiserver = {
|
||||||
|
securePort = 443;
|
||||||
|
advertiseAddress = master.ip;
|
||||||
|
};
|
||||||
|
masterAddress = "${masterName}.${config.networking.domain}";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
(optionalAttrs (any (role: role == "master") machine.roles) {
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
443 # kubernetes apiserver
|
||||||
|
];
|
||||||
|
})
|
||||||
|
(optionalAttrs (machine ? "extraConfiguration") (machine.extraConfiguration { inherit config pkgs lib nodes; }))
|
||||||
|
(optionalAttrs (extraConfiguration != null) (extraConfiguration { inherit config pkgs lib nodes; }))];
|
||||||
|
}) machines;
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
startAll;
|
startAll;
|
||||||
|
|
@ -190,7 +190,7 @@ in {
|
||||||
script = if evaled.config.test.check != null then mkKubernetesSingleNodeTest {
|
script = if evaled.config.test.check != null then mkKubernetesSingleNodeTest {
|
||||||
name = config.name;
|
name = config.name;
|
||||||
test = ''
|
test = ''
|
||||||
$kube->waitUntilSucceeds("kubectl get node machine1.my.zyx | grep -w Ready");
|
$kube->waitUntilSucceeds("kubectl get node kube.my.zyx | grep -w Ready");
|
||||||
${evaled.config.test.check}
|
${evaled.config.test.check}
|
||||||
'';
|
'';
|
||||||
} else null;
|
} else null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue