Merge pull request #10934 from fidencio/topic/agent-unbreak-non-guest-pull-build

agent: Fix non-guest-pull build
This commit is contained in:
Fabiano Fidêncio 2025-02-26 09:45:22 +01:00 committed by GitHub
commit 47a5439a20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -184,6 +184,7 @@ pub async fn unseal_file(path: &str) -> Result<()> {
Ok(()) Ok(())
} }
#[cfg(feature = "guest-pull")]
pub async fn secure_mount( pub async fn secure_mount(
volume_type: &str, volume_type: &str,
options: &std::collections::HashMap<String, String>, options: &std::collections::HashMap<String, String>,

View File

@ -60,6 +60,7 @@ use crate::device::block_device_handler::get_virtio_blk_pci_device_name;
use crate::device::network_device_handler::wait_for_net_interface; use crate::device::network_device_handler::wait_for_net_interface;
use crate::device::{add_devices, handle_cdi_devices, update_env_pci}; use crate::device::{add_devices, handle_cdi_devices, update_env_pci};
use crate::features::get_build_features; use crate::features::get_build_features;
#[cfg(feature = "guest-pull")]
use crate::image::KATA_IMAGE_WORK_DIR; use crate::image::KATA_IMAGE_WORK_DIR;
use crate::linux_abi::*; use crate::linux_abi::*;
use crate::metrics::get_metrics; use crate::metrics::get_metrics;
@ -106,6 +107,7 @@ use kata_types::k8s;
pub const CONTAINER_BASE: &str = "/run/kata-containers"; pub const CONTAINER_BASE: &str = "/run/kata-containers";
const MODPROBE_PATH: &str = "/sbin/modprobe"; const MODPROBE_PATH: &str = "/sbin/modprobe";
#[cfg(feature = "guest-pull")]
const TRUSTED_IMAGE_STORAGE_DEVICE: &str = "/dev/trusted_store"; const TRUSTED_IMAGE_STORAGE_DEVICE: &str = "/dev/trusted_store";
/// the iptables seriers binaries could appear either in /sbin /// the iptables seriers binaries could appear either in /sbin
/// or /usr/sbin, we need to check both of them /// or /usr/sbin, we need to check both of them
@ -2241,11 +2243,13 @@ async fn cdh_handler(oci: &mut Spec) -> Result<()> {
} }
} }
#[cfg(feature = "guest-pull")]
let linux = oci let linux = oci
.linux() .linux()
.as_ref() .as_ref()
.ok_or_else(|| anyhow!("Spec didn't contain linux field"))?; .ok_or_else(|| anyhow!("Spec didn't contain linux field"))?;
#[cfg(feature = "guest-pull")]
if let Some(devices) = linux.devices() { if let Some(devices) = linux.devices() {
for specdev in devices.iter() { for specdev in devices.iter() {
if specdev.path().as_path().to_str() == Some(TRUSTED_IMAGE_STORAGE_DEVICE) { if specdev.path().as_path().to_str() == Some(TRUSTED_IMAGE_STORAGE_DEVICE) {