From e49efd5a1b34f2f86d5c5b7d46d41c95a9c90fe7 Mon Sep 17 00:00:00 2001 From: Paul Cacheux Date: Wed, 11 Dec 2024 18:00:31 +0100 Subject: [PATCH] [CWS] make the security-agent use the remote workload meta only (#32009) --- cmd/security-agent/main_windows.go | 13 ++----------- cmd/security-agent/subcommands/start/command.go | 12 +++--------- pkg/config/setup/config.go | 1 - 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/cmd/security-agent/main_windows.go b/cmd/security-agent/main_windows.go index 6aa47f99d56b4..b81223e6aebc1 100644 --- a/cmd/security-agent/main_windows.go +++ b/cmd/security-agent/main_windows.go @@ -121,17 +121,8 @@ func (s *service) Run(svcctx context.Context) error { // workloadmeta setup wmcatalog.GetCatalog(), - workloadmetafx.ModuleWithProvider(func(config config.Component) workloadmeta.Params { - - catalog := workloadmeta.NodeAgent - - if config.GetBool("security_agent.remote_workloadmeta") { - catalog = workloadmeta.Remote - } - - return workloadmeta.Params{ - AgentType: catalog, - } + workloadmetafx.Module(workloadmeta.Params{ + AgentType: workloadmeta.Remote, }), fx.Provide(func(log log.Component, config config.Component, statsd statsd.Component, wmeta workloadmeta.Component) (status.InformationProvider, *agent.RuntimeSecurityAgent, error) { stopper := startstop.NewSerialStopper() diff --git a/cmd/security-agent/subcommands/start/command.go b/cmd/security-agent/subcommands/start/command.go index 6dec7ce712a4e..8386100c0031b 100644 --- a/cmd/security-agent/subcommands/start/command.go +++ b/cmd/security-agent/subcommands/start/command.go @@ -48,7 +48,7 @@ import ( remoteTaggerfx "github.com/DataDog/datadog-agent/comp/core/tagger/fx-remote" taggerTypes "github.com/DataDog/datadog-agent/comp/core/tagger/types" "github.com/DataDog/datadog-agent/comp/core/telemetry" - wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog" + wmcatalog "github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors/catalog-remote" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" workloadmetafx "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx" "github.com/DataDog/datadog-agent/comp/dogstatsd" @@ -104,14 +104,8 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command { dogstatsd.ClientBundle, // workloadmeta setup wmcatalog.GetCatalog(), - workloadmetafx.ModuleWithProvider(func(config config.Component) workloadmeta.Params { - catalog := workloadmeta.NodeAgent - if config.GetBool("security_agent.remote_workloadmeta") { - catalog = workloadmeta.Remote - } - return workloadmeta.Params{ - AgentType: catalog, - } + workloadmetafx.Module(workloadmeta.Params{ + AgentType: workloadmeta.Remote, }), remoteTaggerfx.Module(tagger.RemoteParams{ RemoteTarget: func(c config.Component) (string, error) { diff --git a/pkg/config/setup/config.go b/pkg/config/setup/config.go index a19de1ebed171..da2fb45d704bb 100644 --- a/pkg/config/setup/config.go +++ b/pkg/config/setup/config.go @@ -898,7 +898,6 @@ func InitConfig(config pkgconfigmodel.Setup) { config.BindEnvAndSetDefault("security_agent.cmd_port", DefaultSecurityAgentCmdPort) config.BindEnvAndSetDefault("security_agent.expvar_port", 5011) config.BindEnvAndSetDefault("security_agent.log_file", DefaultSecurityAgentLogFile) - config.BindEnvAndSetDefault("security_agent.remote_workloadmeta", true) // debug config to enable a remote client to receive data from the workloadmeta agent without a timeout config.BindEnvAndSetDefault("workloadmeta.remote.recv_without_timeout", true)