diff --git a/.github/workflows/pr-linter.yml b/.github/workflows/pr-linter.yml index e3781644da..fda9ee224c 100644 --- a/.github/workflows/pr-linter.yml +++ b/.github/workflows/pr-linter.yml @@ -15,11 +15,12 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v1 - name: Verify Pull Request Labels - uses: jesusvasquez333/verify-pr-label-action@v1.3.1 + uses: jesusvasquez333/verify-pr-label-action@v1.4.0 with: github-token: '${{ secrets.GITHUB_TOKEN }}' valid-labels: 'bug, enhancement, refactoring, documentation, tooling, dependencies' pull-request-number: '${{ github.event.pull_request.number }}' + disable-reviews: true check-milestone: name: Check Milestone runs-on: ubuntu-latest diff --git a/api/datadoghq/common/envvar.go b/api/datadoghq/common/envvar.go index ab1324f757..26382b3577 100644 --- a/api/datadoghq/common/envvar.go +++ b/api/datadoghq/common/envvar.go @@ -47,6 +47,7 @@ const ( DDAPMInstrumentationLibVersions = "DD_APM_INSTRUMENTATION_LIB_VERSIONS" DDAppKey = "DD_APP_KEY" DDAuthTokenFilePath = "DD_AUTH_TOKEN_FILE_PATH" + DDChecksTagCardinality = "DD_CHECKS_TAG_CARDINALITY" DDClcRunnerEnabled = "DD_CLC_RUNNER_ENABLED" DDClcRunnerHost = "DD_CLC_RUNNER_HOST" DDClcRunnerID = "DD_CLC_RUNNER_ID" diff --git a/api/datadoghq/v2alpha1/datadogagent_types.go b/api/datadoghq/v2alpha1/datadogagent_types.go index edfd716210..767cf652c1 100644 --- a/api/datadoghq/v2alpha1/datadogagent_types.go +++ b/api/datadoghq/v2alpha1/datadogagent_types.go @@ -1199,6 +1199,13 @@ type GlobalConfig struct { // +listMapKey=name Env []corev1.EnvVar `json:"env,omitempty"` + // ChecksTagCardinality configures tag cardinality for the metrics collected by integrations (`low`, `orchestrator` or `high`). + // See also: https://docs.datadoghq.com/getting_started/tagging/assigning_tags/?tab=containerizedenvironments#tags-cardinality. + // Not set by default to avoid overriding existing DD_CHECKS_TAG_CARDINALITY configurations, the default value in the Agent is low. + // Ref: https://github.com/DataDog/datadog-agent/blob/856cf4a66142ce91fd4f8a278149436eb971184a/pkg/config/setup/config.go#L625. + // +optional + ChecksTagCardinality *string `json:"checksTagCardinality,omitempty"` + // OriginDetectionUnified defines the origin detection unified mechanism behavior. // +optional OriginDetectionUnified *OriginDetectionUnified `json:"originDetectionUnified,omitempty"` diff --git a/api/datadoghq/v2alpha1/test/builder.go b/api/datadoghq/v2alpha1/test/builder.go index 776e404778..a9d2f2c78b 100644 --- a/api/datadoghq/v2alpha1/test/builder.go +++ b/api/datadoghq/v2alpha1/test/builder.go @@ -789,7 +789,7 @@ func (builder *DatadogAgentBuilder) WithOriginDetectionUnified(enabled bool) *Da return builder } -// Global OriginDetectionUnified +// Global Registry func (builder *DatadogAgentBuilder) WithRegistry(registry string) *DatadogAgentBuilder { builder.datadogAgent.Spec.Global.Registry = apiutils.NewStringPointer(registry) @@ -797,6 +797,13 @@ func (builder *DatadogAgentBuilder) WithRegistry(registry string) *DatadogAgentB return builder } +// Global ChecksTagCardinality + +func (builder *DatadogAgentBuilder) WithChecksTagCardinality(cardinality string) *DatadogAgentBuilder { + builder.datadogAgent.Spec.Global.ChecksTagCardinality = apiutils.NewStringPointer(cardinality) + return builder +} + // Global SecretBackend func (builder *DatadogAgentBuilder) WithGlobalSecretBackendGlobalPerms(command string, args string, timeout int32) *DatadogAgentBuilder { diff --git a/api/datadoghq/v2alpha1/zz_generated.deepcopy.go b/api/datadoghq/v2alpha1/zz_generated.deepcopy.go index fe9b044371..f680c7b1d2 100644 --- a/api/datadoghq/v2alpha1/zz_generated.deepcopy.go +++ b/api/datadoghq/v2alpha1/zz_generated.deepcopy.go @@ -1500,6 +1500,11 @@ func (in *GlobalConfig) DeepCopyInto(out *GlobalConfig) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.ChecksTagCardinality != nil { + in, out := &in.ChecksTagCardinality, &out.ChecksTagCardinality + *out = new(string) + **out = **in + } if in.OriginDetectionUnified != nil { in, out := &in.OriginDetectionUnified, &out.OriginDetectionUnified *out = new(OriginDetectionUnified) diff --git a/config/crd/bases/v1/datadoghq.com_datadogagents.yaml b/config/crd/bases/v1/datadoghq.com_datadogagents.yaml index 20040fc1be..b9d1a8c43b 100644 --- a/config/crd/bases/v1/datadoghq.com_datadogagents.yaml +++ b/config/crd/bases/v1/datadoghq.com_datadogagents.yaml @@ -1454,6 +1454,13 @@ spec: global: description: Global settings to configure the agents properties: + checksTagCardinality: + description: |- + ChecksTagCardinality configures tag cardinality for the metrics collected by integrations (`low`, `orchestrator` or `high`). + See also: https://docs.datadoghq.com/getting_started/tagging/assigning_tags/?tab=containerizedenvironments#tags-cardinality. + Not set by default to avoid overriding existing DD_CHECKS_TAG_CARDINALITY configurations, the default value in the Agent is low. + Ref: https://github.com/DataDog/datadog-agent/blob/856cf4a66142ce91fd4f8a278149436eb971184a/pkg/config/setup/config.go#L625. + type: string clusterAgentToken: description: ClusterAgentToken is the token for communication between the NodeAgent and ClusterAgent. type: string diff --git a/docs/configuration.v2alpha1.md b/docs/configuration.v2alpha1.md index 0a49996053..d932363de9 100644 --- a/docs/configuration.v2alpha1.md +++ b/docs/configuration.v2alpha1.md @@ -163,6 +163,7 @@ spec: | features.serviceDiscovery.enabled | Enables the service discovery check. Default: false | | features.tcpQueueLength.enabled | Enables the TCP queue length eBPF-based check. Default: false | | features.usm.enabled | Enables Universal Service Monitoring. Default: false | +| global.checksTagCardinality | ChecksTagCardinality configures tag cardinality for the metrics collected by integrations (`low`, `orchestrator` or `high`). See also: https://docs.datadoghq.com/getting_started/tagging/assigning_tags/?tab=containerizedenvironments#tags-cardinality. Not set by default to avoid overriding existing DD_CHECKS_TAG_CARDINALITY configurations, the default value in the Agent is low. Ref: https://github.com/DataDog/datadog-agent/blob/856cf4a66142ce91fd4f8a278149436eb971184a/pkg/config/setup/config.go#L625. | | global.clusterAgentToken | ClusterAgentToken is the token for communication between the NodeAgent and ClusterAgent. | | global.clusterAgentTokenSecret.keyName | KeyName is the key of the secret to use. | | global.clusterAgentTokenSecret.secretName | SecretName is the name of the secret. | diff --git a/internal/controller/datadogagent/override/global.go b/internal/controller/datadogagent/override/global.go index 2b5a2032ea..6107d05574 100644 --- a/internal/controller/datadogagent/override/global.go +++ b/internal/controller/datadogagent/override/global.go @@ -148,6 +148,18 @@ func applyGlobalSettings(logger logr.Logger, manager feature.PodTemplateManagers } } + // Configure checks tag cardinality if provided + if componentName == v2alpha1.NodeAgentComponentName { + if config.ChecksTagCardinality != nil { + // The value validation happens at the Agent level - if the lower(string) is not `low`, `orchestrator` or `high`, the Agent defaults to `low`. + // Ref: https://github.com/DataDog/datadog-agent/blob/1d08a6a9783fe271ea3813ddf9abf60244abdf2c/comp/core/tagger/taggerimpl/tagger.go#L173-L177 + manager.EnvVar().AddEnvVar(&corev1.EnvVar{ + Name: apicommon.DDChecksTagCardinality, + Value: *config.ChecksTagCardinality, + }) + } + } + if config.OriginDetectionUnified != nil && config.OriginDetectionUnified.Enabled != nil { manager.EnvVar().AddEnvVar(&corev1.EnvVar{ Name: apicommon.DDOriginDetectionUnified, diff --git a/internal/controller/datadogagent/override/global_test.go b/internal/controller/datadogagent/override/global_test.go index cc153baa30..21441418d0 100644 --- a/internal/controller/datadogagent/override/global_test.go +++ b/internal/controller/datadogagent/override/global_test.go @@ -114,6 +114,20 @@ func TestNodeAgentComponenGlobalSettings(t *testing.T) { wantVolumes: getExpectedVolumes(), want: assertAllAgentSingleContainer, }, + { + name: "Checks tag cardinality set to orchestrator", + singleContainerStrategyEnabled: false, + dda: v2alpha1test.NewDatadogAgentBuilder(). + WithChecksTagCardinality("orchestrator"). + BuildWithDefaults(), + wantEnvVars: getExpectedEnvVars(&corev1.EnvVar{ + Name: apicommon.DDChecksTagCardinality, + Value: "orchestrator", + }), + wantVolumeMounts: emptyVolumeMounts, + wantVolumes: emptyVolumes, + want: assertAll, + }, { name: "Unified origin detection activated", singleContainerStrategyEnabled: false,