Skip to content

Commit

Permalink
Merge branch 'main' into vboulineau/json-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
fanny-jiang authored Nov 19, 2024
2 parents 32970bc + f15528b commit 1b7da63
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions api/datadoghq/common/envvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
9 changes: 8 additions & 1 deletion api/datadoghq/v2alpha1/test/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,21 @@ 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)

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 {
Expand Down
5 changes: 5 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.

7 changes: 7 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.v2alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
12 changes: 12 additions & 0 deletions internal/controller/datadogagent/override/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions internal/controller/datadogagent/override/global_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1b7da63

Please sign in to comment.