Skip to content

Commit

Permalink
service discovery: Add operator support
Browse files Browse the repository at this point in the history
  • Loading branch information
guyarb committed Oct 6, 2024
1 parent 7fe7979 commit cc34cfd
Show file tree
Hide file tree
Showing 17 changed files with 571 additions and 222 deletions.
1 change: 1 addition & 0 deletions api/datadoghq/common/envvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const (
DDSecretBackendCommand = "DD_SECRET_BACKEND_COMMAND"
DDSecretBackendArguments = "DD_SECRET_BACKEND_ARGUMENTS"
DDSecretBackendTimeout = "DD_SECRET_BACKEND_TIMEOUT"
DDServiceDiscoveryEnabled = "DD_DISCOVERY_ENABLED"
DDSite = "DD_SITE"
DDSystemProbeAgentEnabled = "DD_SYSTEM_PROBE_ENABLED"
DDSystemProbeBPFDebugEnabled = DDSystemProbeEnvPrefix + "BPF_DEBUG"
Expand Down
174 changes: 87 additions & 87 deletions api/datadoghq/v1alpha1/zz_generated.openapi.go

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const (

defaultEBPFCheckEnabled bool = false

defaultServiceDiscoveryEnabled bool = false

defaultAPMEnabled bool = true
defaultAPMHostPortEnabled bool = false
defaultAPMHostPort int32 = 8126
Expand Down Expand Up @@ -244,6 +246,11 @@ func defaultFeaturesConfig(ddaSpec *DatadogAgentSpec) {
}
apiutils.DefaultBooleanIfUnset(&ddaSpec.Features.EBPFCheck.Enabled, defaultEBPFCheckEnabled)

if ddaSpec.Features.ServiceDiscovery == nil {
ddaSpec.Features.ServiceDiscovery = &ServiceDiscoveryFeatureConfig{}
}
apiutils.DefaultBooleanIfUnset(&ddaSpec.Features.ServiceDiscovery.Enabled, defaultServiceDiscoveryEnabled)

// APM Feature
// APM is enabled by default
if ddaSpec.Features.APM == nil {
Expand Down
43 changes: 43 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -314,6 +317,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(valueFalse),
},
Expand Down Expand Up @@ -396,6 +402,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(valueFalse),
},
Expand Down Expand Up @@ -507,6 +516,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -639,6 +651,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -766,6 +781,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(valueTrue),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -893,6 +911,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -1029,6 +1050,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -1156,6 +1180,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -1286,6 +1313,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -1443,6 +1473,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
CSPM: &CSPMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultCSPMEnabled),
},
Expand Down Expand Up @@ -1546,6 +1579,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -1654,6 +1690,7 @@ func Test_defaultFeatures(t *testing.T) {
OOMKill: &OOMKillFeatureConfig{},
TCPQueueLength: &TCPQueueLengthFeatureConfig{},
EBPFCheck: &EBPFCheckFeatureConfig{},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{},
APM: &APMFeatureConfig{},
ASM: &ASMFeatureConfig{},
CSPM: &CSPMFeatureConfig{},
Expand Down Expand Up @@ -1695,6 +1732,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down Expand Up @@ -1825,6 +1865,9 @@ func Test_defaultFeatures(t *testing.T) {
EBPFCheck: &EBPFCheckFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultEBPFCheckEnabled),
},
ServiceDiscovery: &ServiceDiscoveryFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultServiceDiscoveryEnabled),
},
APM: &APMFeatureConfig{
Enabled: apiutils.NewBoolPointer(defaultAPMEnabled),
HostPortConfig: &HostPortConfig{
Expand Down
10 changes: 10 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type DatadogFeatures struct {
RemoteConfiguration *RemoteConfigurationFeatureConfig `json:"remoteConfiguration,omitempty"`
// SBOM collection configuration.
SBOM *SBOMFeatureConfig `json:"sbom,omitempty"`
// ServiceDiscovery
ServiceDiscovery *ServiceDiscoveryFeatureConfig `json:"serviceDiscovery,omitempty"`

// Cluster-level features

Expand Down Expand Up @@ -486,6 +488,14 @@ type USMFeatureConfig struct {
Enabled *bool `json:"enabled,omitempty"`
}

// ServiceDiscoveryFeatureConfig configures the service discovery check feature.
type ServiceDiscoveryFeatureConfig struct {
// Enables the service discover check.
// Default: false
// +optional
Enabled *bool `json:"enabled,omitempty"`
}

// DogstatsdFeatureConfig contains the Dogstatsd configuration parameters.
// +k8s:openapi-gen=true
type DogstatsdFeatureConfig struct {
Expand Down
25 changes: 25 additions & 0 deletions api/datadoghq/v2alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cc34cfd

Please sign in to comment.