Skip to content

Commit b136295

Browse files
authored
remove system-probe module config namespaces (#47348)
### What does this PR do? Removes config namespaces for system-probe modules ### Motivation Missing information in `system-probe config` output. We no longer need to explicitly list the config namespaces for the system-probe config. ### Describe how you validated your changes ### Additional Notes Co-authored-by: bryce.kahle <bryce.kahle@datadoghq.com>
1 parent f07e13a commit b136295

31 files changed

Lines changed: 43 additions & 95 deletions

.cursor/rules/system_probe_modules.mdc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ func (t *Tracer) GetAndFlush() model.Stats {
187187
```go
188188
var MyModule = &module.Factory{
189189
Name: config.MyModuleName,
190-
ConfigNamespaces: []string{},
191190
Fn: func(_ *sysconfigtypes.Config, _ module.FactoryDependencies) (module.Module, error) {
192191
t, err := probe.NewTracer(ebpf.NewConfig())
193192
if err != nil {

cmd/system-probe/api/config.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,15 @@ package api
88
import (
99
"github.com/gorilla/mux"
1010

11-
"github.com/DataDog/datadog-agent/cmd/system-probe/modules"
1211
"github.com/DataDog/datadog-agent/comp/core/settings"
13-
"github.com/DataDog/datadog-agent/pkg/system-probe/config"
1412
)
1513

1614
// setupConfigHandlers adds the specific handlers for /config endpoints
1715
func setupConfigHandlers(r *mux.Router, settings settings.Component) {
18-
r.HandleFunc("/config", settings.GetFullConfig(getAggregatedNamespaces()...)).Methods("GET")
19-
r.HandleFunc("/config/without-defaults", settings.GetFullConfigWithoutDefaults(getAggregatedNamespaces()...)).Methods("GET")
16+
r.HandleFunc("/config", settings.GetFullConfig("")).Methods("GET")
17+
r.HandleFunc("/config/without-defaults", settings.GetFullConfigWithoutDefaults("")).Methods("GET")
2018
r.HandleFunc("/config/by-source", settings.GetFullConfigBySource()).Methods("GET")
2119
r.HandleFunc("/config/list-runtime", settings.ListConfigurable).Methods("GET")
2220
r.HandleFunc("/config/{setting}", settings.GetValue).Methods("GET")
2321
r.HandleFunc("/config/{setting}", settings.SetValue).Methods("POST")
2422
}
25-
26-
func getAggregatedNamespaces() []string {
27-
namespaces := []string{
28-
config.Namespace,
29-
}
30-
for _, m := range modules.All() {
31-
namespaces = append(namespaces, m.ConfigNamespaces...)
32-
}
33-
return namespaces
34-
}

cmd/system-probe/modules/AGENTS.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Each module is a `module.Factory` registered in `init()` with the following fiel
1313
```go
1414
var MyModule = &module.Factory{
1515
Name: config.MyModuleName, // Unique identifier
16-
ConfigNamespaces: []string{}, // Config sections to load
1716
Fn: createModule, // Constructor function
1817
NeedsEBPF: func() bool { return true }, // eBPF requirement indicator
1918
}
@@ -29,10 +28,6 @@ func init() {
2928
- Defined as constant in `pkg/system-probe/config/config.go`
3029
- Used to route HTTP requests to the module
3130

32-
- **ConfigNamespaces**: List of configuration namespaces this module needs
33-
- Empty list means no special config loading
34-
- Module-specific configs are typically accessed via module name
35-
3631
- **Fn**: Constructor function signature:
3732
```go
3833
func(*sysconfigtypes.Config, module.FactoryDependencies) (module.Module, error)

cmd/system-probe/modules/compliance.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,15 @@ import (
2828

2929
func init() { registerModule(ComplianceModule) }
3030

31-
var complianceConfigNamespaces = []string{"compliance_config", "runtime_security_config"}
32-
3331
// ComplianceModule is a system-probe module that exposes an HTTP api to
3432
// perform compliance checks that require more privileges than security-agent
3533
// can offer.
3634
//
3735
// For instance, being able to run cross-container checks at runtime by directly
3836
// accessing the /proc/<pid>/root mount point.
3937
var ComplianceModule = &module.Factory{
40-
Name: config.ComplianceModule,
41-
ConfigNamespaces: complianceConfigNamespaces,
42-
Fn: newComplianceModule,
38+
Name: config.ComplianceModule,
39+
Fn: newComplianceModule,
4340
NeedsEBPF: func() bool {
4441
return false
4542
},

cmd/system-probe/modules/crashdetect_windows.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ func init() { registerModule(WinCrashProbe) }
2323

2424
// WinCrashProbe Factory
2525
var WinCrashProbe = &module.Factory{
26-
Name: config.WindowsCrashDetectModule,
27-
ConfigNamespaces: []string{"windows_crash_detection"},
26+
Name: config.WindowsCrashDetectModule,
2827
Fn: func(cfg *sysconfigtypes.Config, _ module.FactoryDependencies) (module.Module, error) {
2928
log.Infof("Starting the WinCrashProbe probe")
3029
cp, err := probe.NewWinCrashProbe(cfg)

cmd/system-probe/modules/discovery_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ func init() { registerModule(DiscoveryModule) }
1515

1616
// DiscoveryModule is the discovery module factory.
1717
var DiscoveryModule = &module.Factory{
18-
Name: config.DiscoveryModule,
19-
ConfigNamespaces: []string{"discovery"},
20-
Fn: discoverymodule.NewDiscoveryModule,
18+
Name: config.DiscoveryModule,
19+
Fn: discoverymodule.NewDiscoveryModule,
2120
NeedsEBPF: func() bool {
2221
return false
2322
},

cmd/system-probe/modules/dynamic_instrumentation.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ func init() { registerModule(DynamicInstrumentation) }
2828
// DynamicInstrumentation is a system probe module which allows you to add instrumentation into
2929
// running Go services without restarts.
3030
var DynamicInstrumentation = &module.Factory{
31-
Name: config.DynamicInstrumentationModule,
32-
ConfigNamespaces: []string{"dynamic_instrumentation"},
31+
Name: config.DynamicInstrumentationModule,
3332
Fn: func(agentConfiguration *sysconfigtypes.Config, deps module.FactoryDependencies) (module.Module, error) {
3433
config, err := dimod.NewConfig(agentConfiguration)
3534
if err != nil {

cmd/system-probe/modules/ebpf.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ func init() { registerModule(EBPFProbe) }
2626

2727
// EBPFProbe Factory
2828
var EBPFProbe = &module.Factory{
29-
Name: config.EBPFModule,
30-
ConfigNamespaces: []string{},
29+
Name: config.EBPFModule,
3130
Fn: func(_ *sysconfigtypes.Config, _ module.FactoryDependencies) (module.Module, error) {
3231
log.Infof("Starting the ebpf probe")
3332
okp, err := ebpfcheck.NewProbe(ebpf.NewConfig())

cmd/system-probe/modules/eventmonitor.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import (
2626
"github.com/DataDog/datadog-agent/pkg/util/log"
2727
)
2828

29-
var eventMonitorModuleConfigNamespaces = []string{"event_monitoring_config", "runtime_security_config"}
30-
3129
func createEventMonitorModule(_ *sysconfigtypes.Config, deps module.FactoryDependencies) (module.Module, error) {
3230
emconfig := emconfig.NewConfig()
3331

cmd/system-probe/modules/eventmonitor_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ func init() { registerModule(EventMonitor) }
2424

2525
// EventMonitor - Event monitor Factory
2626
var EventMonitor = &module.Factory{
27-
Name: config.EventMonitorModule,
28-
ConfigNamespaces: eventMonitorModuleConfigNamespaces,
29-
Fn: createEventMonitorModule,
27+
Name: config.EventMonitorModule,
28+
Fn: createEventMonitorModule,
3029
NeedsEBPF: func() bool {
3130
return !secconfig.IsEBPFLessModeEnabled()
3231
},

0 commit comments

Comments
 (0)