fix: include version in the operator's Kubernetes client User-Agent#3159
Conversation
Co-Authored-By: Claude Opus 4.8 <[email protected]>
🛑 Gate Violations
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3159 +/- ##
=======================================
Coverage 44.03% 44.03%
=======================================
Files 377 377
Lines 30713 30713
=======================================
Hits 13525 13525
Misses 16300 16300
Partials 888 888
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.UserAgenttodatadog-operator/<version>. - Update Datadog code coverage configuration to exclude
cmd/main.gofrom 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.
ea37151 to
31ee444
Compare
What does this PR do?
Appends the operator version to the User-Agent of the operator's Kubernetes client. The
rest.Configbacking the controller-runtime manager now setsUserAgent = "datadog-operator/" + version.Version(set beforectrl.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-operatorUser-Agent with no version, so API-server audit logs and managed control-plane telemetry (GKE Cloud Audit LogscallerSuppliedUserAgent, 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 asv0.0.0).Additional Notes
N/A
Minimum Agent Versions
Describe your test plan
userAgentfield, orcallerSuppliedUserAgent.datadog-operator/<version>instead of baredatadog-operator.--versionoutput / startup logs, which already printversion.Version.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel