Skip to content

fix: include version in the operator's Kubernetes client User-Agent#3159

Merged
tbavelier merged 1 commit into
mainfrom
FRCONS-815/wassim.dhif/operator-user-agent-version
Jun 19, 2026
Merged

fix: include version in the operator's Kubernetes client User-Agent#3159
tbavelier merged 1 commit into
mainfrom
FRCONS-815/wassim.dhif/operator-user-agent-version

Conversation

@wdhif

@wdhif wdhif commented Jun 18, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Appends the operator version to the User-Agent of the operator's Kubernetes client. The rest.Config backing the controller-runtime manager now sets UserAgent = "datadog-operator/" + version.Version (set before ctrl.NewManager, so the manager's cache and clients inherit it), instead of a static "datadog-operator" with no version.

Motivation

The operator's client sent a static datadog-operator User-Agent with no version, so API-server audit logs and managed control-plane telemetry (GKE Cloud Audit Logs callerSuppliedUserAgent, EKS audit logs) could not identify which operator version was issuing calls. Adding the version makes the caller identifiable. Related to FRCONS-815, where the Cluster Agent had the analogous problem (reported as v0.0.0).

Additional Notes

N/A

Minimum Agent Versions

  • Agent: N/A
  • Cluster Agent: N/A

Describe your test plan

  • Build the operator image and deploy it to a cluster.
  • Confirm the API server observes the versioned User-Agent:
    • kube-apiserver audit log → userAgent field, or
    • GKE/EKS control-plane (Cloud) audit logs → callerSuppliedUserAgent.
    • Expect datadog-operator/<version> instead of bare datadog-operator.
  • Cross-check the running version via the operator's --version output / startup logs, which already print version.Version.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label
  • All commits are signed (see: signing commits) — verified (SSH-signed)

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jun 18, 2026

Copy link
Copy Markdown

Code Coverage  Pipelines

Fix all issues with BitsAI

🛑 Gate Violations

🎯 1 Code Coverage issue detected

A Patch coverage percentage gate may be blocking this PR.

Patch coverage: 0.00% (threshold: 80.00%)

⚠️ Warnings

🚦 2 Pipeline jobs failed

pull request linter | Check Milestone   View in Datadog   GitHub Actions

pull request linter | build   View in Datadog   GitHub Actions

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 44.27% (+0.00%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 31ee444 | Docs | Datadog PR Page | Give us feedback!

@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.03%. Comparing base (92788bf) to head (ea37151).

Files with missing lines Patch % Lines
cmd/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3159   +/-   ##
=======================================
  Coverage   44.03%   44.03%           
=======================================
  Files         377      377           
  Lines       30713    30713           
=======================================
  Hits        13525    13525           
  Misses      16300    16300           
  Partials      888      888           
Flag Coverage Δ
unittests 44.03% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/main.go 6.68% <0.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92788bf...ea37151. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wdhif wdhif added enhancement New feature or request qa/skip-qa labels Jun 18, 2026
@wdhif
wdhif marked this pull request as ready for review June 19, 2026 09:48
@wdhif
wdhif requested review from a team and Copilot June 19, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR appends the operator version to the Kubernetes client User-Agent by setting rest.Config.UserAgent before creating the controller-runtime manager, improving audit-log and control-plane telemetry attribution to a specific operator version.

Changes:

  • Set the controller-runtime manager’s backing rest.Config.UserAgent to datadog-operator/<version>.
  • Update Datadog code coverage configuration to exclude cmd/main.go from coverage calculations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cmd/main.go Sets the Kubernetes REST client User-Agent to include version.Version before manager creation.
code-coverage.datadog.yml Excludes cmd/main.go from coverage gates (flagged in review as undesirable coverage bypass).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread code-coverage.datadog.yml Outdated
@wdhif
wdhif force-pushed the FRCONS-815/wassim.dhif/operator-user-agent-version branch from ea37151 to 31ee444 Compare June 19, 2026 09:53
@wdhif wdhif added this to the v1.29.0 milestone Jun 19, 2026
Comment thread cmd/main.go
@tbavelier
tbavelier merged commit 9d4cf55 into main Jun 19, 2026
74 of 77 checks passed
@tbavelier
tbavelier deleted the FRCONS-815/wassim.dhif/operator-user-agent-version branch June 19, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants