diff --git a/src/libs/kata-types/src/config/agent.rs b/src/libs/kata-types/src/config/agent.rs index 34c74cc63d..8b05377c17 100644 --- a/src/libs/kata-types/src/config/agent.rs +++ b/src/libs/kata-types/src/config/agent.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 // +use serde::{Deserialize, Deserializer}; use std::io::Result; use crate::config::{ConfigOps, TomlConfig}; @@ -117,7 +118,8 @@ pub struct Agent { /// have sufficient time to complete. #[serde( default = "default_request_timeout", - rename = "create_container_timeout" + rename = "create_container_timeout", + deserialize_with = "deserialize_secs_to_millis" )] pub request_timeout_ms: u32, @@ -152,6 +154,15 @@ pub struct Agent { pub policy: String, } +fn deserialize_secs_to_millis<'de, D>(deserializer: D) -> std::result::Result +where + D: Deserializer<'de>, +{ + let secs = u32::deserialize(deserializer)?; + + Ok(secs.saturating_mul(1000)) +} + impl std::default::Default for Agent { fn default() -> Self { Self { diff --git a/src/runtime-rs/config/configuration-qemu-runtime-rs-coco-dev.toml.in b/src/runtime-rs/config/configuration-qemu-runtime-rs-coco-dev.toml.in index ce25840a81..2f360c36df 100644 --- a/src/runtime-rs/config/configuration-qemu-runtime-rs-coco-dev.toml.in +++ b/src/runtime-rs/config/configuration-qemu-runtime-rs-coco-dev.toml.in @@ -598,6 +598,19 @@ kernel_modules=[] # (default: 3000) #reconnect_timeout_ms = 3000 +# Create Container Request Timeout +# This timeout value is used to set the maximum duration for the agent to process a CreateContainerRequest. +# It's also used to ensure that workloads, especially those involving large image pulls within the guest, +# have sufficient time to complete. +# +# Effective Timeout Determination: +# The effective timeout for a CreateContainerRequest is determined by taking the minimum of the following two values: +# - create_container_timeout: The timeout value configured for creating containers (default: 30,000 milliseconds). +# - runtime-request-timeout: The timeout value specified in the Kubelet configuration described as the link below: +# (https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/#:~:text=runtime%2Drequest%2Dtimeout) +# Defaults to @DEFCREATECONTAINERTIMEOUT@ second(s) +# create_container_timeout = @DEFCREATECONTAINERTIMEOUT@ + [agent.@PROJECT_TYPE@.mem_agent] # Control the mem-agent function enable or disable. # Default to false