mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-23 02:06:47 +00:00
kata-types: Support create_container_timeout set within configuration
Since it aligns with the create_container_timeout definition in runtime-go, we need to set the value in configuration.toml in seconds, not milliseconds. We must also convert it to milliseconds when the configuration is loaded for request_timeout_ms. Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
parent
c11e18b001
commit
980860d012
@ -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<u32, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
let secs = u32::deserialize(deserializer)?;
|
||||
|
||||
Ok(secs.saturating_mul(1000))
|
||||
}
|
||||
|
||||
impl std::default::Default for Agent {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user