Skip to content

Conversation

@clamoriniere
Copy link
Collaborator

@clamoriniere clamoriniere commented Nov 6, 2025

Open Bits Dev Session

You can ask for changes by mentioning @DataDog in a comment.

Feedback (especially what can be better) welcome in #code-gen-feedback!


What does this PR do?

Implements CONTP-1086 by adding a feature.autodiscovery.extraIgnoreAutoConfig setting to the DatadogAgent CRD. This allows users to configure integrations to ignore from autodiscovery without overriding the operator's default ignored list. Includes generated deepcopy and OpenAPI schema definitions for the new AutodiscoveryConfig struct, feature implementation, and comprehensive unit tests. Additionally marks the Agent component as required in the single-container strategy to ensure proper container selection. Fixes indentation in the autodiscovery feature comment for code consistency.

Motivation

Users previously had to override the entire DD_IGNORE_AUTOCONF environment variable to add custom integrations to the ignore list, which removed the operator's default ignored integrations (e.g., "kubernetes_state"). This caused support issues and inaccurate metrics. The new setting allows appending to the default list instead of replacing it. Marking Agent as required ensures the single-container strategy correctly switches to the unprivileged container when this feature is utilized. Fixing the indentation ensures code quality and maintainability.

Additional Notes

  • New AutodiscoveryConfig struct added to DatadogFeatures with ExtraIgnoreAutoConfig field
  • Generated deepcopy methods for AutodiscoveryConfig to support proper object cloning
  • Generated OpenAPI schema definitions for CRD validation and documentation
  • Updated CRD base files for DatadogAgent, DatadogAgentInternal, and DatadogAgentProfile resources
  • Feature implementation uses AppendToValueEnvVarMergeFunction to merge values with existing environment variables
  • Agent component marked as required to trigger single-container strategy behavior
  • Values are appended to defaults for both Agent and Cluster Agent containers
  • Comprehensive unit tests verify feature correctly merges extra ignore entries with existing DD_IGNORE_AUTOCONF values across all container types
  • Code formatting improvements for consistency

Minimum Agent Versions

  • Agent: v7.0.0
  • Cluster Agent: v1.0.0

Describe your test plan

  • Unit tests verify the feature correctly merges extra ignore entries with existing DD_IGNORE_AUTOCONF values
  • Tests cover DCA and Agent container configurations separately
  • Tests verify single-container strategy behavior with Agent marked as required
  • Tests confirm existing environment variables are properly merged when present
  • Integration tests should verify the environment variable is correctly set on all agent container types
  • Manual testing to confirm autodiscovery respects the merged ignore list

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

@datadog-official
Copy link

datadog-official bot commented Nov 6, 2025

Bits AI Dev Agent Status: ✅ Done [Fix CI Errors]

Status History (20 entries)
2025-11-06 21:41:58 UTC ✅ Processed user query
2025-11-06 21:59:54 UTC ⚠️ Attempted to fix CI failures, no code changes
2025-11-06 22:01:49 UTC ✅ Processed user query, no code changes
2025-11-06 22:04:44 UTC ✅ Processed user query, no code changes
2025-11-06 22:23:10 UTC ✅ Processed user query
2025-11-06 23:28:43 UTC ✅ Pushed a commit per user request
2025-11-06 23:37:17 UTC ✅ Processed user query
2025-11-06 23:49:08 UTC ⚠️ Attempted to fix CI failures, no code changes
2025-11-07 00:17:13 UTC ✅ Pushed a commit per user request
2025-11-07 00:44:00 UTC ⚠️ Attempted to fix CI failures, no code changes
2025-11-07 00:51:01 UTC ✅ Attempted to fix CI failures
2025-11-07 01:19:04 UTC ✅ Attempted to fix CI failures
2025-11-07 01:34:19 UTC ❌ Reached max number of CI failure fix attempts
2025-11-10 18:29:00 UTC ❌ Failed to process user query
2025-11-10 20:22:07 UTC ✅ Processed user query, no code changes
2025-11-10 20:33:09 UTC ✅ Processed user query, no code changes
2025-11-10 20:51:42 UTC ✅ Processed user query
2025-11-10 20:52:42 UTC ✅ Pushed a commit per user request
2025-11-10 21:28:15 UTC ✅ Processed user query, no code changes
2025-11-14 23:41:19 UTC ❎️ Stopped monitoring for CI failures due to age of PR

You can ask for changes by mentioning @DataDog in a comment.

@clamoriniere clamoriniere added this to the v1.21.0 milestone Nov 6, 2025
@clamoriniere clamoriniere added the enhancement New feature or request label Nov 6, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 62.16216% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.35%. Comparing base (490d736) to head (9fdebd8).

Files with missing lines Patch % Lines
...ller/datadogagent/feature/autodiscovery/feature.go 62.16% 9 Missing and 5 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2299      +/-   ##
==========================================
+ Coverage   37.32%   37.35%   +0.03%     
==========================================
  Files         290      291       +1     
  Lines       24720    24757      +37     
==========================================
+ Hits         9226     9249      +23     
- Misses      14781    14790       +9     
- Partials      713      718       +5     
Flag Coverage Δ
unittests 37.35% <62.16%> (+0.03%) ⬆️

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

Files with missing lines Coverage Δ
internal/controller/datadogagent/controller.go 51.85% <ø> (ø)
...ller/datadogagent/feature/autodiscovery/feature.go 62.16% <62.16%> (ø)

Continue to review full report in Codecov by Sentry.

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

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

@clamoriniere clamoriniere force-pushed the dd/contp-1086/add-autodiscovery-extra-ignore branch from e0866f5 to 8d2f73c Compare November 7, 2025 11:02
@clamoriniere clamoriniere marked this pull request as ready for review November 7, 2025 11:51
@clamoriniere clamoriniere requested review from a team as code owners November 7, 2025 11:51
@clamoriniere clamoriniere changed the title Add spec.global.extra_ignore_autoconfig in DatadogAgent Add spec.feature.autodiscovery.extra_ignore_autoconfig in DatadogAgent Nov 10, 2025
@clamoriniere clamoriniere changed the title Add spec.feature.autodiscovery.extra_ignore_autoconfig in DatadogAgent Add spec.features.autodiscovery.extra_ignore_autoconfig in DatadogAgent Nov 10, 2025
@clamoriniere clamoriniere changed the title Add spec.features.autodiscovery.extra_ignore_autoconfig in DatadogAgent Add spec.feature.autodiscovery.extra_ignore_autoconfig in DatadogAgent Nov 10, 2025
Copy link
Contributor

@fanny-jiang fanny-jiang left a comment

Choose a reason for hiding this comment

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

LGTM, just needs one change to register the new feature

@khewonc khewonc modified the milestones: v1.21.0, v1.22.0 Nov 14, 2025
@levan-m levan-m modified the milestones: v1.22.0, v1.23.0 Dec 10, 2025
@clamoriniere clamoriniere force-pushed the dd/contp-1086/add-autodiscovery-extra-ignore branch from 2752b78 to ae9658a Compare December 26, 2025 11:43
CONTP-1086: move autoconfig ignore to features
@clamoriniere clamoriniere force-pushed the dd/contp-1086/add-autodiscovery-extra-ignore branch from ae9658a to 9fdebd8 Compare December 26, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bits AI enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants