Skip to content

Commit fb30729

Browse files
committed
CI work
1 parent 8f932bf commit fb30729

3 files changed

Lines changed: 208 additions & 162 deletions

File tree

default.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,20 @@ rec {
4242
{
4343
nixkube.cache.enable = false;
4444
nixkube.builders.enable = false;
45+
# push = true retains Nix string context on DaemonSet store paths so
46+
# they become part of the manifest's closure. The NixOS test VM then
47+
# has every path in /nix/store, where nix-serve makes them available
48+
# as a substituter for nixkube's separate /var/lib/nix-csi store.
49+
nixkube.push = true;
4550
nixkube.systems = {
4651
x86_64-linux = true;
4752
aarch64-linux = false;
4853
};
54+
# 10.113.37.1 is the PTP CNI gateway — the host-side veth IP reachable
55+
# from all pods. nix-serve runs there during the NixOS test.
56+
nixkube.node.nixConfig.settings.substituters = [
57+
"http://10.113.37.1:5000?trusted=1"
58+
];
4959
}
5060
];
5161
};

tests/nixos/cluster-module.nix

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
pkgs.kubernetes # kubectl, kubeadm, kubelet
1717
pkgs.cri-tools # crictl
1818
pkgs.helix # editor
19+
pkgs.k9s
20+
pkgs.fish
21+
pkgs.stern
1922
];
2023

2124
environment.variables.EDITOR = "hx";
@@ -47,20 +50,23 @@
4750
};
4851
};
4952

50-
# -- CNI bridge config --
51-
# Simple bridge CNI — no cluster-level setup needed, just this config file.
52-
environment.etc."cni/net.d/10-bridge.conflist".text = builtins.toJSON {
53+
# -- CNI ptp config --
54+
# PTP (point-to-point) CNI: each pod gets a veth pair, no shared bridge.
55+
# Traffic between pods is routed at L3 on the host, which lets kube-proxy
56+
# iptables/ipvs rules see and rewrite service traffic correctly.
57+
environment.etc."cni/net.d/10-ptp.conflist".text = builtins.toJSON {
5358
cniVersion = "1.0.0";
54-
name = "bridge";
59+
name = "ptp";
5560
plugins = [
5661
{
57-
type = "bridge";
58-
bridge = "cni0";
59-
isGateway = true;
62+
type = "ptp";
6063
ipMasq = true;
6164
ipam = {
6265
type = "host-local";
63-
ranges = [ [ { subnet = "10.244.0.0/16"; } ] ];
66+
subnet = "10.113.37.0/24";
67+
# Explicit gateway ensures the host-side veth always gets this IP,
68+
# which nixkube pods use to reach nix-serve on the VM.
69+
gateway = "10.113.37.1";
6470
routes = [ { dst = "0.0.0.0/0"; } ];
6571
};
6672
}
@@ -137,6 +143,19 @@
137143
memorySize = 4096;
138144
diskSize = 10240;
139145
cores = 4;
146+
# cache=unsafe tells QEMU to ack writes immediately without flushing to the
147+
# host — eliminates the I/O errors that remount the FS read-only in tests.
148+
qemu.drives = lib.mkForce [
149+
{
150+
name = "root";
151+
file = "\"$NIX_DISK_IMAGE\"";
152+
driveExtraOpts = {
153+
cache = "unsafe";
154+
format = "qcow2";
155+
"if" = "ide";
156+
};
157+
}
158+
];
140159
};
141160

142161
# -- Interactive debug user --
@@ -160,6 +179,16 @@
160179
"d /var/run/nri 0755 root root -"
161180
];
162181

182+
# Serve the VM's /nix/store as an unsigned binary cache on port 5000.
183+
# nixkube pods use this as a trusted substituter so test workload paths can be
184+
# fetched without going to the internet (paths pre-populated via additionalPaths).
185+
services.nix-serve = {
186+
enable = true;
187+
package = pkgs.nix-serve-ng;
188+
bindAddress = "0.0.0.0";
189+
port = 5000;
190+
};
191+
163192
# Enable external networking for image pulls and nix binary cache access
164193
# SLiRP provides DHCP + DNS automatically
165194
networking.firewall.enable = false;

0 commit comments

Comments
 (0)