-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathconfig_init_serverless.go
More file actions
54 lines (45 loc) · 2.06 KB
/
Copy pathconfig_init_serverless.go
File metadata and controls
54 lines (45 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
//go:build serverless
package setup
import (
pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model"
"github.com/DataDog/datadog-agent/pkg/util/log"
)
func initConfig() {
ddcfg := GlobalConfigBuilder()
initCommonBase(ddcfg)
}
func fixupInitConfig() {
ddcfg := Datadog()
fixupInitCommonConfigComponents(ddcfg)
fixupInitServerlessOnlyComponents(ddcfg)
}
// fixupPostBuildConfig is a no-op in serverless builds, which have no system-probe config.
func fixupPostBuildConfig() {}
// called only for full-agent, ONLY for serverless, after declaring settings
func fixupInitServerlessOnlyComponents(_ pkgconfigmodel.Config) { // nolint:unused,deadcode this is only used by serverless
// Do not extend this list !
//
// Those are legacy behavior that should not be extend. The same config must be compatible with any Agent no
// matter its version (serverless, full, IOT, ...). We must be able to look at a configuration and deduce
// exactly the Agent behavior. The only acceptable difference are OS defaults (path, port, ...).
//
// If some product are not compatible with serverless, that difference in behavior must be handle within those
// products not through configuration defaults manipulation.
// Those setting are disable to silence logs but do not entirely disable the data collection for k8s or sbom.
pkgconfigmodel.AddOverrideFunc(func(config pkgconfigmodel.Config) {
for name, defaultVal := range map[string]interface{}{
"sbom.container_image.exclude_pause_container": false,
"kubernetes_persistent_volume_claims_as_tags": false,
"kubernetes_node_annotations_as_tags": map[string]string{},
} {
if !config.IsConfigured(name) {
log.Debugf("Disabling %s by default since we are in serverless mode", name)
config.Set(name, defaultVal, pkgconfigmodel.SourceConfigPostInit)
}
}
})
}