mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-29 19:24:23 +01:00
tracing: Remove trace mode and trace type
Remove the `trace_mode` and `trace_type` agent tracing options as decided in the Architecture Committee meeting. See: - https://github.com/kata-containers/kata-containers/pull/2062 Fixes: #2352. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
@@ -117,10 +117,8 @@ type HypervisorInfo struct {
|
||||
|
||||
// AgentInfo stores agent details
|
||||
type AgentInfo struct {
|
||||
TraceMode string
|
||||
TraceType string
|
||||
Debug bool
|
||||
Trace bool
|
||||
Debug bool
|
||||
Trace bool
|
||||
}
|
||||
|
||||
// DistroInfo stores host operating system distribution details.
|
||||
@@ -157,11 +155,11 @@ type EnvInfo struct {
|
||||
Meta MetaInfo
|
||||
Image ImageInfo
|
||||
Initrd InitrdInfo
|
||||
Agent AgentInfo
|
||||
Hypervisor HypervisorInfo
|
||||
Netmon NetmonInfo
|
||||
Runtime RuntimeInfo
|
||||
Netmon NetmonInfo
|
||||
Host HostInfo
|
||||
Agent AgentInfo
|
||||
}
|
||||
|
||||
func getMetaInfo() MetaInfo {
|
||||
@@ -303,8 +301,6 @@ func getAgentInfo(config oci.RuntimeConfig) (AgentInfo, error) {
|
||||
agentConfig := config.AgentConfig
|
||||
agent.Debug = agentConfig.Debug
|
||||
agent.Trace = agentConfig.Trace
|
||||
agent.TraceMode = agentConfig.TraceMode
|
||||
agent.TraceType = agentConfig.TraceType
|
||||
|
||||
return agent, nil
|
||||
}
|
||||
|
||||
@@ -184,10 +184,6 @@ func getExpectedAgentDetails(config oci.RuntimeConfig) (AgentInfo, error) {
|
||||
return AgentInfo{
|
||||
Debug: agentConfig.Debug,
|
||||
Trace: agentConfig.Trace,
|
||||
|
||||
// No trace mode/type set by default
|
||||
TraceMode: "",
|
||||
TraceType: "",
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -677,14 +673,10 @@ func TestEnvGetAgentInfo(t *testing.T) {
|
||||
assert.True(t, agent.Debug)
|
||||
|
||||
agentConfig.Trace = true
|
||||
agentConfig.TraceMode = "traceMode"
|
||||
agentConfig.TraceType = "traceType"
|
||||
config.AgentConfig = agentConfig
|
||||
agent, err = getAgentInfo(config)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, agent.Trace)
|
||||
assert.Equal(t, agent.TraceMode, "traceMode")
|
||||
assert.Equal(t, agent.TraceType, "traceType")
|
||||
}
|
||||
|
||||
func testEnvShowTOMLSettings(t *testing.T, tmpdir string, tmpfile *os.File) error {
|
||||
|
||||
@@ -124,24 +124,17 @@ block_device_driver = "@DEFBLOCKSTORAGEDRIVER_ACRN@"
|
||||
|
||||
# Enable agent tracing.
|
||||
#
|
||||
# If enabled, the default trace mode is "dynamic" and the
|
||||
# default trace type is "isolated". The trace mode and type are set
|
||||
# explicity with the `trace_type=` and `trace_mode=` options.
|
||||
# If enabled, the agent will generate OpenTelemetry trace spans.
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
# - Tracing is ONLY enabled when `enable_tracing` is set: explicitly
|
||||
# setting `trace_mode=` and/or `trace_type=` without setting `enable_tracing`
|
||||
# will NOT activate agent tracing.
|
||||
#
|
||||
# - See https://github.com/kata-containers/agent/blob/master/TRACING.md for
|
||||
# full details.
|
||||
# - If the runtime also has tracing enabled, the agent spans will be
|
||||
# associated with the appropriate runtime parent span.
|
||||
# - If enabled, the runtime will wait for the container to shutdown,
|
||||
# increasing the container shutdown time slightly.
|
||||
#
|
||||
# (default: disabled)
|
||||
#enable_tracing = true
|
||||
#
|
||||
#trace_mode = "dynamic"
|
||||
#trace_type = "isolated"
|
||||
|
||||
# Enable debug console.
|
||||
|
||||
|
||||
@@ -144,24 +144,17 @@ block_device_driver = "virtio-blk"
|
||||
|
||||
# Enable agent tracing.
|
||||
#
|
||||
# If enabled, the default trace mode is "dynamic" and the
|
||||
# default trace type is "isolated". The trace mode and type are set
|
||||
# explicity with the `trace_type=` and `trace_mode=` options.
|
||||
# If enabled, the agent will generate OpenTelemetry trace spans.
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
# - Tracing is ONLY enabled when `enable_tracing` is set: explicitly
|
||||
# setting `trace_mode=` and/or `trace_type=` without setting `enable_tracing`
|
||||
# will NOT activate agent tracing.
|
||||
#
|
||||
# - See https://github.com/kata-containers/agent/blob/master/TRACING.md for
|
||||
# full details.
|
||||
# - If the runtime also has tracing enabled, the agent spans will be
|
||||
# associated with the appropriate runtime parent span.
|
||||
# - If enabled, the runtime will wait for the container to shutdown,
|
||||
# increasing the container shutdown time slightly.
|
||||
#
|
||||
# (default: disabled)
|
||||
#enable_tracing = true
|
||||
#
|
||||
#trace_mode = "dynamic"
|
||||
#trace_type = "isolated"
|
||||
|
||||
# Enable debug console.
|
||||
|
||||
|
||||
@@ -246,24 +246,17 @@ valid_entropy_sources = @DEFVALIDENTROPYSOURCES@
|
||||
|
||||
# Enable agent tracing.
|
||||
#
|
||||
# If enabled, the default trace mode is "dynamic" and the
|
||||
# default trace type is "isolated". The trace mode and type are set
|
||||
# explicity with the `trace_type=` and `trace_mode=` options.
|
||||
# If enabled, the agent will generate OpenTelemetry trace spans.
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
# - Tracing is ONLY enabled when `enable_tracing` is set: explicitly
|
||||
# setting `trace_mode=` and/or `trace_type=` without setting `enable_tracing`
|
||||
# will NOT activate agent tracing.
|
||||
#
|
||||
# - See https://github.com/kata-containers/agent/blob/master/TRACING.md for
|
||||
# full details.
|
||||
# - If the runtime also has tracing enabled, the agent spans will be
|
||||
# associated with the appropriate runtime parent span.
|
||||
# - If enabled, the runtime will wait for the container to shutdown,
|
||||
# increasing the container shutdown time slightly.
|
||||
#
|
||||
# (default: disabled)
|
||||
#enable_tracing = true
|
||||
#
|
||||
#trace_mode = "dynamic"
|
||||
#trace_type = "isolated"
|
||||
|
||||
# Comma separated list of kernel modules and their parameters.
|
||||
# These modules will be loaded in the guest kernel using modprobe(8).
|
||||
|
||||
@@ -422,24 +422,17 @@ valid_entropy_sources = @DEFVALIDENTROPYSOURCES@
|
||||
|
||||
# Enable agent tracing.
|
||||
#
|
||||
# If enabled, the default trace mode is "dynamic" and the
|
||||
# default trace type is "isolated". The trace mode and type are set
|
||||
# explicity with the `trace_type=` and `trace_mode=` options.
|
||||
# If enabled, the agent will generate OpenTelemetry trace spans.
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
# - Tracing is ONLY enabled when `enable_tracing` is set: explicitly
|
||||
# setting `trace_mode=` and/or `trace_type=` without setting `enable_tracing`
|
||||
# will NOT activate agent tracing.
|
||||
#
|
||||
# - See https://github.com/kata-containers/agent/blob/master/TRACING.md for
|
||||
# full details.
|
||||
# - If the runtime also has tracing enabled, the agent spans will be
|
||||
# associated with the appropriate runtime parent span.
|
||||
# - If enabled, the runtime will wait for the container to shutdown,
|
||||
# increasing the container shutdown time slightly.
|
||||
#
|
||||
# (default: disabled)
|
||||
#enable_tracing = true
|
||||
#
|
||||
#trace_mode = "dynamic"
|
||||
#trace_type = "isolated"
|
||||
|
||||
# Comma separated list of kernel modules and their parameters.
|
||||
# These modules will be loaded in the guest kernel using modprobe(8).
|
||||
|
||||
@@ -23,8 +23,6 @@ type RuntimeConfigOptions struct {
|
||||
NetmonPath string
|
||||
LogPath string
|
||||
BlockDeviceDriver string
|
||||
AgentTraceMode string
|
||||
AgentTraceType string
|
||||
SharedFS string
|
||||
VirtioFSDaemon string
|
||||
JaegerEndpoint string
|
||||
@@ -137,8 +135,6 @@ func MakeRuntimeConfigFileData(config RuntimeConfigOptions) string {
|
||||
[agent.kata]
|
||||
enable_debug = ` + strconv.FormatBool(config.AgentDebug) + `
|
||||
enable_tracing = ` + strconv.FormatBool(config.AgentTrace) + `
|
||||
trace_mode = "` + config.AgentTraceMode + `"` + `
|
||||
trace_type = "` + config.AgentTraceType + `"` + `
|
||||
|
||||
[netmon]
|
||||
path = "` + config.NetmonPath + `"
|
||||
|
||||
@@ -153,8 +153,6 @@ type runtime struct {
|
||||
}
|
||||
|
||||
type agent struct {
|
||||
TraceMode string `toml:"trace_mode"`
|
||||
TraceType string `toml:"trace_type"`
|
||||
KernelModules []string `toml:"kernel_modules"`
|
||||
Debug bool `toml:"enable_debug"`
|
||||
Tracing bool `toml:"enable_tracing"`
|
||||
@@ -489,14 +487,6 @@ func (a agent) trace() bool {
|
||||
return a.Tracing
|
||||
}
|
||||
|
||||
func (a agent) traceMode() string {
|
||||
return a.TraceMode
|
||||
}
|
||||
|
||||
func (a agent) traceType() string {
|
||||
return a.TraceType
|
||||
}
|
||||
|
||||
func (a agent) kernelModules() []string {
|
||||
return a.KernelModules
|
||||
}
|
||||
@@ -929,8 +919,6 @@ func updateRuntimeConfigAgent(configPath string, tomlConf tomlConfig, config *oc
|
||||
LongLiveConn: true,
|
||||
Debug: agent.debug(),
|
||||
Trace: agent.trace(),
|
||||
TraceMode: agent.traceMode(),
|
||||
TraceType: agent.traceType(),
|
||||
KernelModules: agent.kernelModules(),
|
||||
EnableDebugConsole: agent.debugConsoleEnabled(),
|
||||
DialTimeout: agent.dialTimout(),
|
||||
@@ -976,10 +964,6 @@ func SetKernelParams(runtimeConfig *oci.RuntimeConfig) error {
|
||||
}
|
||||
|
||||
// next, check for agent specific kernel params
|
||||
err := vc.KataAgentSetDefaultTraceConfigOptions(&runtimeConfig.AgentConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params := vc.KataAgentKernelParams(runtimeConfig.AgentConfig)
|
||||
|
||||
|
||||
@@ -1152,9 +1152,6 @@ func TestAgentDefaults(t *testing.T) {
|
||||
|
||||
a.Tracing = true
|
||||
assert.Equal(a.trace(), a.Tracing)
|
||||
|
||||
assert.Equal(a.traceMode(), a.TraceMode)
|
||||
assert.Equal(a.traceType(), a.TraceType)
|
||||
}
|
||||
|
||||
func TestGetDefaultConfigFilePaths(t *testing.T) {
|
||||
|
||||
@@ -105,16 +105,6 @@ var (
|
||||
GuestDNSFile = "/etc/resolv.conf"
|
||||
)
|
||||
|
||||
const (
|
||||
agentTraceModeDynamic = "dynamic"
|
||||
agentTraceModeStatic = "static"
|
||||
agentTraceTypeIsolated = "isolated"
|
||||
agentTraceTypeCollated = "collated"
|
||||
|
||||
defaultAgentTraceMode = agentTraceModeDynamic
|
||||
defaultAgentTraceType = agentTraceTypeIsolated
|
||||
)
|
||||
|
||||
const (
|
||||
grpcCheckRequest = "grpc.CheckRequest"
|
||||
grpcExecProcessRequest = "grpc.ExecProcessRequest"
|
||||
@@ -221,8 +211,6 @@ func ephemeralPath() string {
|
||||
// KataAgentConfig is a structure storing information needed
|
||||
// to reach the Kata Containers agent.
|
||||
type KataAgentConfig struct {
|
||||
TraceMode string
|
||||
TraceType string
|
||||
KernelModules []string
|
||||
ContainerPipeSize uint32
|
||||
DialTimeout uint32
|
||||
@@ -268,34 +256,6 @@ func (k *kataAgent) longLiveConn() bool {
|
||||
return k.keepConn
|
||||
}
|
||||
|
||||
// KataAgentSetDefaultTraceConfigOptions validates agent trace options and
|
||||
// sets defaults.
|
||||
func KataAgentSetDefaultTraceConfigOptions(config *KataAgentConfig) error {
|
||||
if !config.Trace {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch config.TraceMode {
|
||||
case agentTraceModeDynamic:
|
||||
case agentTraceModeStatic:
|
||||
case "":
|
||||
config.TraceMode = defaultAgentTraceMode
|
||||
default:
|
||||
return fmt.Errorf("invalid kata agent trace mode: %q (need %q or %q)", config.TraceMode, agentTraceModeDynamic, agentTraceModeStatic)
|
||||
}
|
||||
|
||||
switch config.TraceType {
|
||||
case agentTraceTypeIsolated:
|
||||
case agentTraceTypeCollated:
|
||||
case "":
|
||||
config.TraceType = defaultAgentTraceType
|
||||
default:
|
||||
return fmt.Errorf("invalid kata agent trace type: %q (need %q or %q)", config.TraceType, agentTraceTypeIsolated, agentTraceTypeCollated)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// KataAgentKernelParams returns a list of Kata Agent specific kernel
|
||||
// parameters.
|
||||
func KataAgentKernelParams(config KataAgentConfig) []Param {
|
||||
@@ -305,8 +265,8 @@ func KataAgentKernelParams(config KataAgentConfig) []Param {
|
||||
params = append(params, Param{Key: "agent.log", Value: "debug"})
|
||||
}
|
||||
|
||||
if config.Trace && config.TraceMode == agentTraceModeStatic {
|
||||
params = append(params, Param{Key: "agent.trace", Value: config.TraceType})
|
||||
if config.Trace {
|
||||
params = append(params, Param{Key: "agent.trace", Value: "true"})
|
||||
}
|
||||
|
||||
if config.ContainerPipeSize > 0 {
|
||||
@@ -323,17 +283,14 @@ func KataAgentKernelParams(config KataAgentConfig) []Param {
|
||||
}
|
||||
|
||||
func (k *kataAgent) handleTraceSettings(config KataAgentConfig) bool {
|
||||
if !config.Trace {
|
||||
return false
|
||||
}
|
||||
|
||||
disableVMShutdown := false
|
||||
|
||||
switch config.TraceMode {
|
||||
case agentTraceModeStatic:
|
||||
if config.Trace {
|
||||
// Agent tracing requires that the agent be able to shutdown
|
||||
// cleanly. This is the only scenario where the agent is
|
||||
// responsible for stopping the VM: normally this is handled
|
||||
// by the runtime.
|
||||
disableVMShutdown = true
|
||||
case agentTraceModeDynamic:
|
||||
k.dynamicTracing = true
|
||||
}
|
||||
|
||||
return disableVMShutdown
|
||||
|
||||
@@ -997,75 +997,43 @@ func TestKataAgentKernelParams(t *testing.T) {
|
||||
debug bool
|
||||
trace bool
|
||||
containerPipeSize uint32
|
||||
traceMode string
|
||||
traceType string
|
||||
expectedParams []Param
|
||||
}
|
||||
|
||||
debugParam := Param{Key: "agent.log", Value: "debug"}
|
||||
|
||||
traceIsolatedParam := Param{Key: "agent.trace", Value: "isolated"}
|
||||
traceCollatedParam := Param{Key: "agent.trace", Value: "collated"}
|
||||
|
||||
traceFooParam := Param{Key: "agent.trace", Value: "foo"}
|
||||
traceParam := Param{Key: "agent.trace", Value: "true"}
|
||||
|
||||
containerPipeSizeParam := Param{Key: vcAnnotations.ContainerPipeSizeKernelParam, Value: "2097152"}
|
||||
|
||||
data := []testData{
|
||||
{false, false, 0, "", "", []Param{}},
|
||||
{true, false, 0, "", "", []Param{debugParam}},
|
||||
{false, false, 0, []Param{}},
|
||||
|
||||
{false, false, 0, "foo", "", []Param{}},
|
||||
{false, false, 0, "foo", "", []Param{}},
|
||||
{false, false, 0, "", "foo", []Param{}},
|
||||
{false, false, 0, "", "foo", []Param{}},
|
||||
{false, false, 0, "foo", "foo", []Param{}},
|
||||
{false, true, 0, "foo", "foo", []Param{}},
|
||||
// Debug
|
||||
{true, false, 0, []Param{debugParam}},
|
||||
|
||||
{false, false, 0, agentTraceModeDynamic, "", []Param{}},
|
||||
{false, false, 0, agentTraceModeStatic, "", []Param{}},
|
||||
{false, false, 0, "", agentTraceTypeIsolated, []Param{}},
|
||||
{false, false, 0, "", agentTraceTypeCollated, []Param{}},
|
||||
{false, false, 0, "foo", agentTraceTypeIsolated, []Param{}},
|
||||
{false, false, 0, "foo", agentTraceTypeCollated, []Param{}},
|
||||
// Tracing
|
||||
{false, true, 0, []Param{traceParam}},
|
||||
|
||||
{false, false, 0, agentTraceModeDynamic, agentTraceTypeIsolated, []Param{}},
|
||||
{false, false, 0, agentTraceModeDynamic, agentTraceTypeCollated, []Param{}},
|
||||
// Debug + Tracing
|
||||
{true, true, 0, []Param{debugParam, traceParam}},
|
||||
|
||||
{false, false, 0, agentTraceModeStatic, agentTraceTypeCollated, []Param{}},
|
||||
{false, false, 0, agentTraceModeStatic, agentTraceTypeCollated, []Param{}},
|
||||
// pipesize
|
||||
{false, false, 2097152, []Param{containerPipeSizeParam}},
|
||||
|
||||
{false, true, 0, agentTraceModeDynamic, agentTraceTypeIsolated, []Param{}},
|
||||
{false, true, 0, agentTraceModeDynamic, agentTraceTypeCollated, []Param{}},
|
||||
{true, true, 0, agentTraceModeDynamic, agentTraceTypeCollated, []Param{debugParam}},
|
||||
// Debug + pipesize
|
||||
{true, false, 2097152, []Param{debugParam, containerPipeSizeParam}},
|
||||
|
||||
{false, true, 0, "", agentTraceTypeIsolated, []Param{}},
|
||||
{false, true, 0, "", agentTraceTypeCollated, []Param{}},
|
||||
{true, true, 0, "", agentTraceTypeIsolated, []Param{debugParam}},
|
||||
{true, true, 0, "", agentTraceTypeCollated, []Param{debugParam}},
|
||||
{false, true, 0, "foo", agentTraceTypeIsolated, []Param{}},
|
||||
{false, true, 0, "foo", agentTraceTypeCollated, []Param{}},
|
||||
{true, true, 0, "foo", agentTraceTypeIsolated, []Param{debugParam}},
|
||||
{true, true, 0, "foo", agentTraceTypeCollated, []Param{debugParam}},
|
||||
// Tracing + pipesize
|
||||
{false, true, 2097152, []Param{traceParam, containerPipeSizeParam}},
|
||||
|
||||
{false, true, 0, agentTraceModeStatic, agentTraceTypeIsolated, []Param{traceIsolatedParam}},
|
||||
{false, true, 0, agentTraceModeStatic, agentTraceTypeCollated, []Param{traceCollatedParam}},
|
||||
{true, true, 0, agentTraceModeStatic, agentTraceTypeIsolated, []Param{traceIsolatedParam, debugParam}},
|
||||
{true, true, 0, agentTraceModeStatic, agentTraceTypeCollated, []Param{traceCollatedParam, debugParam}},
|
||||
|
||||
{false, true, 0, agentTraceModeStatic, "foo", []Param{traceFooParam}},
|
||||
{true, true, 0, agentTraceModeStatic, "foo", []Param{debugParam, traceFooParam}},
|
||||
|
||||
{false, false, 0, "", "", []Param{}},
|
||||
{false, false, 2097152, "", "", []Param{containerPipeSizeParam}},
|
||||
// Debug + Tracing + pipesize
|
||||
{true, true, 2097152, []Param{debugParam, traceParam, containerPipeSizeParam}},
|
||||
}
|
||||
|
||||
for i, d := range data {
|
||||
config := KataAgentConfig{
|
||||
Debug: d.debug,
|
||||
Trace: d.trace,
|
||||
TraceMode: d.traceMode,
|
||||
TraceType: d.traceType,
|
||||
ContainerPipeSize: d.containerPipeSize,
|
||||
}
|
||||
|
||||
@@ -1090,25 +1058,20 @@ func TestKataAgentHandleTraceSettings(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
type testData struct {
|
||||
traceMode string
|
||||
trace bool
|
||||
expectDisableVMShutdown bool
|
||||
expectDynamicTracing bool
|
||||
}
|
||||
|
||||
data := []testData{
|
||||
{"", false, false, false},
|
||||
{"", true, false, false},
|
||||
{agentTraceModeStatic, true, true, false},
|
||||
{agentTraceModeDynamic, true, false, true},
|
||||
{false, false},
|
||||
{true, true},
|
||||
}
|
||||
|
||||
for i, d := range data {
|
||||
k := &kataAgent{}
|
||||
|
||||
config := KataAgentConfig{
|
||||
Trace: d.trace,
|
||||
TraceMode: d.traceMode,
|
||||
Trace: d.trace,
|
||||
}
|
||||
|
||||
disableVMShutdown := k.handleTraceSettings(config)
|
||||
@@ -1118,78 +1081,6 @@ func TestKataAgentHandleTraceSettings(t *testing.T) {
|
||||
} else {
|
||||
assert.Falsef(disableVMShutdown, "test %d (%+v)", i, d)
|
||||
}
|
||||
|
||||
if d.expectDynamicTracing {
|
||||
assert.Truef(k.dynamicTracing, "test %d (%+v)", i, d)
|
||||
} else {
|
||||
assert.Falsef(k.dynamicTracing, "test %d (%+v)", i, d)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestKataAgentSetDefaultTraceConfigOptions(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
type testData struct {
|
||||
traceMode string
|
||||
traceType string
|
||||
trace bool
|
||||
expectDefaultTraceMode bool
|
||||
expectDefaultTraceType bool
|
||||
expectError bool
|
||||
}
|
||||
|
||||
data := []testData{
|
||||
{"", "", false, false, false, false},
|
||||
{agentTraceModeDynamic, agentTraceTypeCollated, false, false, false, false},
|
||||
{agentTraceModeDynamic, agentTraceTypeIsolated, false, false, false, false},
|
||||
{agentTraceModeStatic, agentTraceTypeCollated, false, false, false, false},
|
||||
{agentTraceModeStatic, agentTraceTypeIsolated, false, false, false, false},
|
||||
|
||||
{agentTraceModeDynamic, agentTraceTypeCollated, true, false, false, false},
|
||||
{agentTraceModeDynamic, agentTraceTypeIsolated, true, false, false, false},
|
||||
|
||||
{agentTraceModeStatic, agentTraceTypeCollated, true, false, false, false},
|
||||
{agentTraceModeStatic, agentTraceTypeIsolated, true, false, false, false},
|
||||
|
||||
{agentTraceModeDynamic, "", true, false, true, false},
|
||||
{agentTraceModeDynamic, "invalid", true, false, false, true},
|
||||
|
||||
{agentTraceModeStatic, "", true, false, true, false},
|
||||
{agentTraceModeStatic, "invalid", true, false, false, true},
|
||||
|
||||
{"", agentTraceTypeIsolated, true, true, false, false},
|
||||
{"invalid", agentTraceTypeIsolated, true, false, false, true},
|
||||
|
||||
{"", agentTraceTypeCollated, true, true, false, false},
|
||||
{"invalid", agentTraceTypeCollated, true, false, false, true},
|
||||
|
||||
{"", "", true, true, true, false},
|
||||
{"invalid", "invalid", true, false, false, true},
|
||||
}
|
||||
|
||||
for i, d := range data {
|
||||
config := &KataAgentConfig{
|
||||
Trace: d.trace,
|
||||
TraceMode: d.traceMode,
|
||||
TraceType: d.traceType,
|
||||
}
|
||||
|
||||
err := KataAgentSetDefaultTraceConfigOptions(config)
|
||||
if d.expectError {
|
||||
assert.Error(err, "test %d (%+v)", i, d)
|
||||
continue
|
||||
} else {
|
||||
assert.NoError(err, "test %d (%+v)", i, d)
|
||||
}
|
||||
|
||||
if d.expectDefaultTraceMode {
|
||||
assert.Equalf(config.TraceMode, defaultAgentTraceMode, "test %d (%+v)", i, d)
|
||||
}
|
||||
|
||||
if d.expectDefaultTraceType {
|
||||
assert.Equalf(config.TraceType, defaultAgentTraceType, "test %d (%+v)", i, d)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -272,12 +272,6 @@ const (
|
||||
// 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"
|
||||
|
||||
// AgentContainerPipeSize is an annotation to specify the size of the pipes created for containers
|
||||
AgentContainerPipeSize = kataAnnotAgentPrefix + ContainerPipeSizeOption
|
||||
ContainerPipeSizeOption = "container_pipe_size"
|
||||
|
||||
@@ -844,14 +844,6 @@ func addAgentConfigOverrides(ocispec specs.Spec, config *vc.SandboxConfig) error
|
||||
return err
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.AgentTraceMode]; ok {
|
||||
c.TraceMode = value
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.AgentTraceType]; ok {
|
||||
c.TraceType = value
|
||||
}
|
||||
|
||||
if err := newAnnotationConfiguration(ocispec, vcAnnotations.AgentContainerPipeSize).setUint(func(containerPipeSize uint64) {
|
||||
c.ContainerPipeSize = uint32(containerPipeSize)
|
||||
}); err != nil {
|
||||
|
||||
@@ -122,8 +122,6 @@ func TestVMConfigGrpc(t *testing.T) {
|
||||
Trace: false,
|
||||
EnableDebugConsole: false,
|
||||
ContainerPipeSize: 0,
|
||||
TraceMode: "",
|
||||
TraceType: "",
|
||||
KernelModules: []string{}},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user