Skip to content

feat: allow overriding instance label#2671

Open
fad3t wants to merge 3 commits into
DataDog:mainfrom
fad3t:fix-agent-labels
Open

feat: allow overriding instance label#2671
fad3t wants to merge 3 commits into
DataDog:mainfrom
fad3t:fix-agent-labels

Conversation

@fad3t
Copy link
Copy Markdown

@fad3t fad3t commented May 19, 2026

Allow overriding app.kubernetes.io/instance label per workload

Summary

PR #2111 (released in 3.140.0) changed the app.kubernetes.io/instance label on the Agent, Cluster Agent, and Cluster Checks Runner workloads from <release-name> to <fullname>-<workload> (e.g. datadog-agent, datadog-cluster-agent). This is a breaking change for users whose NetworkPolicies — or any other selector — pin on the previous value.

agents.additionalLabels doesn't solve the problem: it appends labels, producing duplicate keys when the key already exists in the templated label set.

This PR adds three new values:

  • agents.instanceLabelOverride
  • clusterAgent.instanceLabelOverride
  • clusterChecksRunner.instanceLabelOverride

When set, each overrides the app.kubernetes.io/instance label on the corresponding workload (both metadata.labels and spec.template.metadata.labels). When unset (default), behavior is unchanged from current main.

Usage

Restore the pre-3.140.0 label so existing NetworkPolicies keep matching:

agents:
  instanceLabelOverride: datadog
clusterAgent:
  instanceLabelOverride: datadog
clusterChecksRunner:
  instanceLabelOverride: datadog

Why scoped to a single label

PR #2111 only changed app.kubernetes.io/instance. The other three app.kubernetes.io/* labels emitted by datadog.pod-template-labels were unaffected, so a generic labelOverrides map would be wider scope than needed. Keeping it to one string value keeps the helper diff minimal and the values surface obvious.

Safety

app.kubernetes.io/instance is not part of any DaemonSet/Deployment selector.matchLabels (selectors use app: <fullname>...), so overriding the value does not run into immutability issues on upgrade.

Test plan

  • helm template with defaults: output is byte-identical to current main for the relevant manifests
  • helm template … --set agents.instanceLabelOverride=datadog --set clusterAgent.instanceLabelOverride=datadog --set clusterChecksRunner.instanceLabelOverride=datadog: confirm the app.kubernetes.io/instance value flips on the agent DaemonSet, cluster-agent Deployment, and cluster-checks-runner Deployment (both metadata and pod template)
  • Existing CI matrix passes
  • helm-docs regenerated (README in sync)

Related

Signed-off-by: Frederic Mereu <frederic.mereu@gaming1.com>
@fad3t fad3t requested review from a team as code owners May 19, 2026 10:06
@fad3t fad3t requested review from tedkahwaji and removed request for a team May 19, 2026 10:06
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ca6d3345d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread charts/datadog/values.yaml
Comment thread charts/datadog/templates/_helpers.tpl Outdated
Signed-off-by: Frederic Mereu <frederic.mereu@gaming1.com>
@fad3t
Copy link
Copy Markdown
Author

fad3t commented May 19, 2026

Related to #2309

@fad3t
Copy link
Copy Markdown
Author

fad3t commented May 21, 2026

Let me know if there's anything else required to move this one forward :) Thanks!

@fad3t
Copy link
Copy Markdown
Author

fad3t commented May 29, 2026

Can you help move this one forward please? Thanks @tedkahwaji !

@fad3t
Copy link
Copy Markdown
Author

fad3t commented Jun 5, 2026

Any maintainer to approve the workflow please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants