runtime: Enable to get cdh_api_timeout from configuration file

This commit allows `cdh_api_timeout` to be configured from the configuration file.
The configuration is commented out with specifying a default value (50s) because
the default value is configured in the agent.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
This commit is contained in:
Hyounggyu Choi
2024-08-22 13:22:25 +02:00
parent 8615516823
commit 7d0aba1a24
10 changed files with 42 additions and 0 deletions

View File

@@ -282,6 +282,10 @@ kernel_modules=[]
# (default: 45) # (default: 45)
dial_timeout = 45 dial_timeout = 45
# Confidential Data Hub API timeout value in seconds
# (default: 50)
#cdh_api_timeout = 50
[runtime] [runtime]
# If enabled, the runtime will log additional debug messages to the # If enabled, the runtime will log additional debug messages to the
# system log # system log

View File

@@ -157,6 +157,10 @@ disable_selinux=@DEFDISABLESELINUX@
# (default: 45) # (default: 45)
dial_timeout = 45 dial_timeout = 45
# Confidential Data Hub API timeout value in seconds
# (default: 50)
#cdh_api_timeout = 50
[runtime] [runtime]
# If enabled, the runtime will log additional debug messages to the # If enabled, the runtime will log additional debug messages to the
# system log # system log

View File

@@ -328,6 +328,10 @@ block_device_driver = "virtio-blk"
# (default: 45) # (default: 45)
dial_timeout = 45 dial_timeout = 45
# Confidential Data Hub API timeout value in seconds
# (default: 50)
#cdh_api_timeout = 50
[runtime] [runtime]
# If enabled, the runtime will log additional debug messages to the # If enabled, the runtime will log additional debug messages to the
# system log # system log

View File

@@ -282,6 +282,10 @@ kernel_modules=[]
# (default: 45) # (default: 45)
dial_timeout = 45 dial_timeout = 45
# Confidential Data Hub API timeout value in seconds
# (default: 50)
#cdh_api_timeout = 50
[runtime] [runtime]
# If enabled, the runtime will log additional debug messages to the # If enabled, the runtime will log additional debug messages to the
# system log # system log

View File

@@ -567,6 +567,10 @@ kernel_modules=[]
# (default: 45) # (default: 45)
dial_timeout = 45 dial_timeout = 45
# Confidential Data Hub API timeout value in seconds
# (default: 50)
#cdh_api_timeout = 50
[runtime] [runtime]
# If enabled, the runtime will log additional debug messages to the # If enabled, the runtime will log additional debug messages to the
# system log # system log

View File

@@ -566,6 +566,10 @@ kernel_modules=[]
# (default: 45) # (default: 45)
dial_timeout = 45 dial_timeout = 45
# Confidential Data Hub API timeout value in seconds
# (default: 50)
#cdh_api_timeout = 50
[runtime] [runtime]
# If enabled, the runtime will log additional debug messages to the # If enabled, the runtime will log additional debug messages to the
# system log # system log

View File

@@ -294,6 +294,10 @@ kernel_modules = []
# (default: 45) # (default: 45)
dial_timeout = 45 dial_timeout = 45
# Confidential Data Hub API timeout value in seconds
# (default: 50)
#cdh_api_timeout = 50
[runtime] [runtime]
# If enabled, the runtime will log additional debug messages to the # If enabled, the runtime will log additional debug messages to the
# system log # system log

View File

@@ -198,6 +198,7 @@ type agent struct {
Tracing bool `toml:"enable_tracing"` Tracing bool `toml:"enable_tracing"`
DebugConsoleEnabled bool `toml:"debug_console_enabled"` DebugConsoleEnabled bool `toml:"debug_console_enabled"`
DialTimeout uint32 `toml:"dial_timeout"` DialTimeout uint32 `toml:"dial_timeout"`
CdhApiTimeout uint32 `toml:"cdh_api_timeout"`
} }
func (orig *tomlConfig) Clone() tomlConfig { func (orig *tomlConfig) Clone() tomlConfig {
@@ -736,6 +737,10 @@ func (a agent) dialTimout() uint32 {
return a.DialTimeout return a.DialTimeout
} }
func (a agent) cdhApiTimout() uint32 {
return a.CdhApiTimeout
}
func (a agent) debug() bool { func (a agent) debug() bool {
return a.Debug return a.Debug
} }
@@ -1415,6 +1420,7 @@ func updateRuntimeConfigAgent(configPath string, tomlConf tomlConfig, config *oc
KernelModules: agent.kernelModules(), KernelModules: agent.kernelModules(),
EnableDebugConsole: agent.debugConsoleEnabled(), EnableDebugConsole: agent.debugConsoleEnabled(),
DialTimeout: agent.dialTimout(), DialTimeout: agent.dialTimout(),
CdhApiTimeout: agent.cdhApiTimout(),
} }
} }

View File

@@ -283,6 +283,7 @@ type KataAgentConfig struct {
KernelModules []string KernelModules []string
ContainerPipeSize uint32 ContainerPipeSize uint32
DialTimeout uint32 DialTimeout uint32
CdhApiTimeout uint32
LongLiveConn bool LongLiveConn bool
Debug bool Debug bool
Trace bool Trace bool
@@ -348,6 +349,11 @@ func KataAgentKernelParams(config KataAgentConfig) []Param {
params = append(params, Param{Key: kernelParamDebugConsoleVPort, Value: kernelParamDebugConsoleVPortValue}) params = append(params, Param{Key: kernelParamDebugConsoleVPort, Value: kernelParamDebugConsoleVPortValue})
} }
if config.CdhApiTimeout > 0 {
cdhApiTimeout := strconv.FormatUint(uint64(config.CdhApiTimeout), 10)
params = append(params, Param{Key: vcAnnotations.CdhApiTimeoutKernelParam, Value: cdhApiTimeout})
}
return params return params
} }

View File

@@ -309,6 +309,8 @@ const (
AgentContainerPipeSize = kataAnnotAgentPrefix + ContainerPipeSizeOption AgentContainerPipeSize = kataAnnotAgentPrefix + ContainerPipeSizeOption
ContainerPipeSizeOption = "container_pipe_size" ContainerPipeSizeOption = "container_pipe_size"
ContainerPipeSizeKernelParam = "agent." + ContainerPipeSizeOption ContainerPipeSizeKernelParam = "agent." + ContainerPipeSizeOption
CdhApiTimeoutOption = "cdh_api_timeout"
CdhApiTimeoutKernelParam = "agent." + CdhApiTimeoutOption
// Policy is an annotation containing the contents of an agent policy file, base64 encoded. // Policy is an annotation containing the contents of an agent policy file, base64 encoded.
Policy = kataAnnotAgentPrefix + "policy" Policy = kataAnnotAgentPrefix + "policy"