From aa2e72f94cf6be11bc2c93dfb48150fee1525d01 Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Sat, 4 Apr 2026 11:29:46 +0200 Subject: [PATCH] kata-types: Add pod_resource_api_sock configuration for GPU cold-plug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Go runtime already exposes a [runtime] pod_resource_api_sock option that tells the shim where to find the kubelet Pod Resources API socket. The runtime-rs VFIO cold-plug code needs the same setting so it can query assigned GPU devices before the VM starts. Add the field to RuntimeConfig and wire it through deserialization so that configuration-*.toml files can set it. Signed-off-by: Alex Lyn Signed-off-by: Fabiano FidĂȘncio --- src/libs/kata-types/src/config/runtime.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libs/kata-types/src/config/runtime.rs b/src/libs/kata-types/src/config/runtime.rs index 077c6b96db..7bc097dcb5 100644 --- a/src/libs/kata-types/src/config/runtime.rs +++ b/src/libs/kata-types/src/config/runtime.rs @@ -181,6 +181,26 @@ pub struct Runtime { /// If fd passthrough io is enabled, the runtime will attempt to use the specified port instead of the default port. #[serde(default = "default_passfd_listener_port")] pub passfd_listener_port: u32, + + /// pod_resource_api_sock specifies the unix socket for the Kubelet's + /// PodResource API endpoint. If empty, kubernetes based cold plug + /// will not be attempted. In order for this feature to work, the + /// KubeletPodResourcesGet featureGate must be enabled in Kubelet, + /// if using Kubelet older than 1.34. + + /// The pod resource API's socket is relative to the Kubelet's root-dir, + /// which is defined by the cluster admin, and its location is: + /// ${KubeletRootDir}/pod-resources/kubelet.sock + + /// cold_plug_vfio(see hypervisor config) acts as a feature gate: + /// cold_plug_vfio = no_port (default) => no cold plug + /// cold_plug_vfio != no_port AND pod_resource_api_sock = "" => need + /// explicit CDI annotation for cold plug (applies mainly + /// to non-k8s cases) + /// cold_plug_vfio != no_port AND pod_resource_api_sock != "" => kubelet + /// based cold plug. + #[serde(default)] + pub pod_resource_api_sock: String, } fn default_passfd_listener_port() -> u32 {