Merge pull request #11474 from Apokleos/remote-annotation

runtime-rs: Add GPU annotations for remote hypervisor
This commit is contained in:
Alex Lyn
2025-06-30 14:05:15 +08:00
committed by GitHub
4 changed files with 37 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ remote_hypervisor_timeout = 600
# Each member of the list is a regular expression, which is the base name
# of the annotation, e.g. "path" for io.katacontainers.config.hypervisor.path"
# Note: Remote hypervisor is only handling the following annotations
enable_annotations = ["machine_type", "default_memory", "default_vcpus"]
enable_annotations = ["machine_type", "default_memory", "default_vcpus", "default_gpus", "default_gpu_model"]
# Optional space-separated list of options to pass to the guest kernel.
# For example, use `kernel_params = "vsyscall=emulate"` if you are having

View File

@@ -12,6 +12,7 @@ use async_trait::async_trait;
use kata_types::{
annotations::{
cri_containerd::{SANDBOX_NAMESPACE_LABEL_KEY, SANDBOX_NAME_LABEL_KEY},
KATA_ANNO_CFG_HYPERVISOR_DEFAULT_GPUS, KATA_ANNO_CFG_HYPERVISOR_DEFAULT_GPU_MODEL,
KATA_ANNO_CFG_HYPERVISOR_DEFAULT_MEMORY, KATA_ANNO_CFG_HYPERVISOR_DEFAULT_VCPUS,
KATA_ANNO_CFG_HYPERVISOR_IMAGE_PATH, KATA_ANNO_CFG_HYPERVISOR_MACHINE_TYPE,
},
@@ -124,6 +125,14 @@ impl RemoteInner {
KATA_ANNO_CFG_HYPERVISOR_IMAGE_PATH.to_string(),
config.boot_info.image.to_string(),
);
annotations.insert(
KATA_ANNO_CFG_HYPERVISOR_DEFAULT_GPUS.to_string(),
config.remote_info.default_gpus.to_string(),
);
annotations.insert(
KATA_ANNO_CFG_HYPERVISOR_DEFAULT_GPU_MODEL.to_string(),
config.remote_info.default_gpu_model.to_string(),
);
annotations
}