From 6043870224051eea3c01fd85b4226c25c2947fc0 Mon Sep 17 00:00:00 2001 From: Moritz Sanft <58110325+msanft@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:19:41 +0100 Subject: [PATCH] node-installer: pass through CDI annotations For GPU support, Kata needs CDI pod annotations. We need to configure containerd to pass these through to Kata. --- nodeinstaller/internal/constants/constants.go | 4 ++++ nodeinstaller/testdata/expected-aks-clh-snp.toml | 2 +- nodeinstaller/testdata/expected-bare-metal-qemu-snp.toml | 2 +- nodeinstaller/testdata/expected-bare-metal-qemu-tdx.toml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nodeinstaller/internal/constants/constants.go b/nodeinstaller/internal/constants/constants.go index de5d2dc751..db0e05db34 100644 --- a/nodeinstaller/internal/constants/constants.go +++ b/nodeinstaller/internal/constants/constants.go @@ -137,6 +137,10 @@ func ContainerdRuntimeConfigFragment(baseDir, snapshotter string, platform platf cfg.Options = map[string]any{ "ConfigPath": filepath.Join(baseDir, "etc", "configuration-qemu-snp.toml"), } + // For GPU support, we need to pass through the CDI annotations. + if platform == platforms.K3sQEMUSNPGPU { + cfg.PodAnnotations = append(cfg.PodAnnotations, "cdi.k8s.io/*") + } default: return nil, fmt.Errorf("unsupported platform: %s", platform) } diff --git a/nodeinstaller/testdata/expected-aks-clh-snp.toml b/nodeinstaller/testdata/expected-aks-clh-snp.toml index d0fd3f2ba7..4efc3e85f9 100644 --- a/nodeinstaller/testdata/expected-aks-clh-snp.toml +++ b/nodeinstaller/testdata/expected-aks-clh-snp.toml @@ -49,7 +49,7 @@ SystemdCgroup = false [plugins.'io.containerd.grpc.v1.cri'.containerd.runtimes.my-runtime] runtime_type = 'io.containerd.contrast-cc.v2' runtime_path = '/opt/edgeless/my-runtime/bin/containerd-shim-contrast-cc-v2' -pod_annotations = ['io.katacontainers.*'] +pod_annotations = ['io.katacontainers.*', 'cdi.k8s.io/*'] privileged_without_host_devices = true snapshotter = 'tardev-my-runtime' diff --git a/nodeinstaller/testdata/expected-bare-metal-qemu-snp.toml b/nodeinstaller/testdata/expected-bare-metal-qemu-snp.toml index 454de9a790..3cf6bb66e2 100644 --- a/nodeinstaller/testdata/expected-bare-metal-qemu-snp.toml +++ b/nodeinstaller/testdata/expected-bare-metal-qemu-snp.toml @@ -50,7 +50,7 @@ SystemdCgroup = false [plugins.'io.containerd.grpc.v1.cri'.containerd.runtimes.my-runtime] runtime_type = 'io.containerd.contrast-cc.v2' runtime_path = '/opt/edgeless/my-runtime/bin/containerd-shim-contrast-cc-v2' -pod_annotations = ['io.katacontainers.*'] +pod_annotations = ['io.katacontainers.*', 'cdi.k8s.io/*'] privileged_without_host_devices = true snapshotter = 'nydus-my-runtime' diff --git a/nodeinstaller/testdata/expected-bare-metal-qemu-tdx.toml b/nodeinstaller/testdata/expected-bare-metal-qemu-tdx.toml index b8cb650748..e239704e71 100644 --- a/nodeinstaller/testdata/expected-bare-metal-qemu-tdx.toml +++ b/nodeinstaller/testdata/expected-bare-metal-qemu-tdx.toml @@ -50,7 +50,7 @@ SystemdCgroup = false [plugins.'io.containerd.grpc.v1.cri'.containerd.runtimes.my-runtime] runtime_type = 'io.containerd.contrast-cc.v2' runtime_path = '/opt/edgeless/my-runtime/bin/containerd-shim-contrast-cc-v2' -pod_annotations = ['io.katacontainers.*'] +pod_annotations = ['io.katacontainers.*', 'cdi.k8s.io/*'] privileged_without_host_devices = true snapshotter = 'nydus-my-runtime'