k8s vm tests: create the agent netns before k3s starts a pod, and delete pods strictly again
This commit is contained in:
parent
f7696a59c1
commit
898b02c5ad
1 changed files with 35 additions and 16 deletions
19
nix/vm-tests/lib/agent-netns.nix
Normal file
19
nix/vm-tests/lib/agent-netns.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# A node module for a VM test whose script gives the hive bridge a client in the
|
||||
# network namespace `agent`. The namespace is created before k3s starts, so
|
||||
# the `ip netns add` that makes `/run/netns` a mount point has run before any
|
||||
# pod's namespace is mounted there. Run later, it mounts `/run/netns` over the
|
||||
# pods' namespaces, and containerd then cannot remove them: a deleted pod stays
|
||||
# Terminating until the node reboots.
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
systemd.services.agent-netns = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "k3s.service" ];
|
||||
path = [ pkgs.iproute2 ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = "ip netns add agent";
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue