mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 00:37:24 +00:00
annotations: add Annotations for the agent.
The annotations handle the tracing config for the agent. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
5b78a8a0f8
commit
8405b56e6f
@ -180,6 +180,7 @@ const (
|
|||||||
BlockDeviceCacheNoflush = kataAnnotHypervisorPrefix + "block_device_cache_noflush"
|
BlockDeviceCacheNoflush = kataAnnotHypervisorPrefix + "block_device_cache_noflush"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Agent related annotations
|
||||||
const (
|
const (
|
||||||
kataAnnotRuntimePrefix = kataConfAnnotationsPrefix + "runtime."
|
kataAnnotRuntimePrefix = kataConfAnnotationsPrefix + "runtime."
|
||||||
|
|
||||||
@ -215,6 +216,15 @@ const (
|
|||||||
// The first word is considered as the module name and the rest as its parameters.
|
// The first word is considered as the module name and the rest as its parameters.
|
||||||
//
|
//
|
||||||
KernelModules = kataAnnotAgentPrefix + "kernel_modules"
|
KernelModules = kataAnnotAgentPrefix + "kernel_modules"
|
||||||
|
|
||||||
|
// AgentTrace is a sandbox annotation to enable tracing for the agent.
|
||||||
|
AgentTrace = kataAnnotAgentPrefix + "enable_tracing"
|
||||||
|
|
||||||
|
// AgentTraceMode is a sandbox annotation to specify the trace mode for the agent.
|
||||||
|
AgentTraceMode = kataAnnotAgentPrefix + "trace_mode"
|
||||||
|
|
||||||
|
// AgentTraceMode is a sandbox annotation to specify the trace type for the agent.
|
||||||
|
AgentTraceType = kataAnnotAgentPrefix + "trace_type"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -714,14 +714,35 @@ func addRuntimeConfigOverrides(ocispec specs.Spec, sbConfig *vc.SandboxConfig) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addAgentConfigOverrides(ocispec specs.Spec, config *vc.SandboxConfig) error {
|
func addAgentConfigOverrides(ocispec specs.Spec, config *vc.SandboxConfig) error {
|
||||||
if value, ok := ocispec.Annotations[vcAnnotations.KernelModules]; ok {
|
c, ok := config.AgentConfig.(vc.KataAgentConfig)
|
||||||
if c, ok := config.AgentConfig.(vc.KataAgentConfig); ok {
|
if !ok {
|
||||||
modules := strings.Split(value, KernelModulesSeparator)
|
return nil
|
||||||
c.KernelModules = modules
|
|
||||||
config.AgentConfig = c
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if value, ok := ocispec.Annotations[vcAnnotations.KernelModules]; ok {
|
||||||
|
modules := strings.Split(value, KernelModulesSeparator)
|
||||||
|
c.KernelModules = modules
|
||||||
|
config.AgentConfig = c
|
||||||
|
}
|
||||||
|
|
||||||
|
if value, ok := ocispec.Annotations[vcAnnotations.AgentTrace]; ok {
|
||||||
|
trace, err := strconv.ParseBool(value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error parsing annotation for agent.trace: Please specify boolean value 'true|false'")
|
||||||
|
}
|
||||||
|
c.Trace = trace
|
||||||
|
}
|
||||||
|
|
||||||
|
if value, ok := ocispec.Annotations[vcAnnotations.AgentTraceMode]; ok {
|
||||||
|
c.TraceMode = value
|
||||||
|
}
|
||||||
|
|
||||||
|
if value, ok := ocispec.Annotations[vcAnnotations.AgentTraceType]; ok {
|
||||||
|
c.TraceType = value
|
||||||
|
}
|
||||||
|
|
||||||
|
config.AgentConfig = c
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user