1 # A test that containerdConfigTemplate settings get written to containerd/config.toml
2 import ../make-test-python.nix (
13 name = "${k3s.name}-containerd-config";
17 environment.systemPackages = [ pkgs.jq ];
18 # k3s uses enough resources the default vm fails.
19 virtualisation.memorySize = 1536;
20 virtualisation.diskSize = 4096;
25 # Slightly reduce resource usage
28 "--disable local-storage"
29 "--disable metrics-server"
32 "--node-name ${nodeName}"
34 containerdConfigTemplate = ''
36 {{ template "base" . }}
45 machine.wait_for_unit("k3s")
46 # wait until the node is ready
47 machine.wait_until_succeeds(r"""kubectl get node ${nodeName} -ojson | jq -e '.status.conditions[] | select(.type == "Ready") | .status == "True"'""")
48 # test whether the config template file contains the magic comment
49 out=machine.succeed("cat /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl")
50 assert "MAGIC COMMENT" in out, "the containerd config template does not contain the magic comment"
51 # test whether the config file contains the magic comment
52 out=machine.succeed("cat /var/lib/rancher/k3s/agent/etc/containerd/config.toml")
53 assert "MAGIC COMMENT" in out, "the containerd config does not contain the magic comment"
56 meta.maintainers = lib.teams.k3s.members;