Skip to content

Commit 92b8b8e

Browse files
committed
Allow configuring of kata containers
1 parent 87902c6 commit 92b8b8e

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

modules/containerd-kubelet.nix

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,22 @@ in
77
{
88
options.virtualisation.containerd-kubelet = {
99
enable = mkEnableOption "containerd as kubelet container runtime";
10+
11+
kata = {
12+
enable = mkEnableOption "enable kata container runtime";
13+
14+
package = lib.mkOption {
15+
type = lib.types.package;
16+
default = pkgs.kata-runtime;
17+
defaultText = lib.literalExpression "pkgs.kata-runtime";
18+
description = "Configured kata-runtime package.";
19+
};
20+
};
1021
};
1122
config = mkIf cfg.enable {
12-
environment.systemPackages = [ pkgs.cri-tools ];
23+
environment.systemPackages = [
24+
pkgs.cri-tools
25+
] ++ lib.optional cfg.kata.enable cfg.kata.package;
1326
environment.etc."crictl.yaml".text = ''
1427
runtime-endpoint: unix:///run/containerd/containerd.sock
1528
'';
@@ -34,6 +47,10 @@ in
3447
SystemdCgroup = true;
3548
};
3649
};
50+
} // lib.optionalAttrs cfg.kata.enable {
51+
kata = {
52+
runtime_type = "io.containerd.kata.v2";
53+
};
3754
};
3855
};
3956
cni.bin_dir = "/opt/cni/bin";
@@ -55,7 +72,10 @@ in
5572
## TODO: environment.etc."cni/net.d/99-loopback.conf".source = copyFile "${pkgs.containerd-unwrapped.src}/contrib/cni/99-loopback.conf";
5673

5774
systemd.services.containerd = {
58-
path = [ pkgs.zfs pkgs.iptables-nftables-compat ];
75+
path = [
76+
pkgs.zfs
77+
pkgs.iptables-nftables-compat
78+
] ++ lib.optional cfg.kata.enable cfg.kata.package;
5979
serviceConfig = {
6080
# This limit was reduce from infinty to 1024:524288 as part of nixos 24.11. Raising that limit slightly.
6181
LimitNOFILE = "32768:524288";

0 commit comments

Comments
 (0)