Skip to content

Commit

Permalink
[CWS] make the security-agent use the remote workload meta only (#32009)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux authored Dec 11, 2024
1 parent 56af0ca commit e49efd5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
13 changes: 2 additions & 11 deletions cmd/security-agent/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 3 additions & 9 deletions cmd/security-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion pkg/config/setup/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e49efd5

Please sign in to comment.