Skip to content

Conversation

@khewonc
Copy link
Contributor

@khewonc khewonc commented Jan 13, 2026

What does this PR do?

Adds a preprocessor for configmaps and moves ksm config md5 hash generation to preprocessor.
To generate the hash annotation, the following labels were added to the configmaps:

  • operator.datadoghq.com/config-id: identifying id for the custom config, e.g. ksm. Used to create the annotation key for the hash
  • operator.datadoghq.com/component.<componentName>: component name. Used to tell the operator which components the hash should be added to

Open to discussing different label names. The component label was chosen so that you could still search for specific component dependencies using kubectl get pod -l operator.datadoghq.com/component.clusterAgent and add multiple component labels to a pod

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

Default KSM settings:

  • Check that the cm and dca pod labels have the same hash annotation as each other
  • Check that the cm has the labels operator.datadoghq.com/config-id=ksm and operator.datadoghq.com/component.clusterAgent=true

Override KSM config using configdata:

    kubeStateMetricsCore:
      conf:
        configData: |
          cluster_check: true
          init_config:
          instances:
            - skip_leader_election: true
              collectors:
              - pods
  • Check that the cm and dca pod labels have the same hash annotation as each other and that it has changed from the previous test using default settings
  • Check that the cm has the labels operator.datadoghq.com/config-id=ksm and operator.datadoghq.com/component.clusterAgent=true

Enable cluster checks runner:

    clusterChecks:
      enabled: true
      useClusterChecksRunners: true
  • Check that the cm and dca pod labels have the same hash annotation as each other
  • Check that the cm has the labels operator.datadoghq.com/config-id=ksm and operator.datadoghq.com/component.clusterAgent=true (not clusterChecksRunner)

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)

@khewonc khewonc added this to the v1.24.0 milestone Jan 13, 2026
@khewonc khewonc requested review from a team as code owners January 13, 2026 21:44
@khewonc khewonc added the enhancement New feature or request label Jan 13, 2026
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 29.48718% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.04%. Comparing base (b4b6e01) to head (ca228e4).

Files with missing lines Patch % Lines
...ternal/controller/datadogagent/store/preprocess.go 22.58% 23 Missing and 1 partial ⚠️
internal/controller/datadogagent/store/store.go 30.00% 7 Missing ⚠️
...datadogagentinternal/controller_reconcile_agent.go 0.00% 6 Missing ⚠️
...troller/datadogagent/controller_reconcile_agent.go 16.66% 4 Missing and 1 partial ⚠️
...ler/datadogagentinternal/component_clusteragent.go 0.00% 3 Missing ⚠️
...adogagentinternal/component_clusterchecksrunner.go 0.00% 3 Missing ⚠️
...ller/datadogagent/component_clusterchecksrunner.go 33.33% 1 Missing and 1 partial ⚠️
...adogagent/feature/kubernetesstatecore/configmap.go 80.00% 1 Missing and 1 partial ⚠️
pkg/constants/utils.go 0.00% 2 Missing ⚠️
pkg/kubernetes/const.go 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (29.48%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2489      +/-   ##
==========================================
- Coverage   38.09%   38.04%   -0.06%     
==========================================
  Files         299      299              
  Lines       25182    25227      +45     
==========================================
+ Hits         9594     9598       +4     
- Misses      14853    14895      +42     
+ Partials      735      734       -1     
Flag Coverage Δ
unittests 38.04% <29.48%> (-0.06%) ⬇️

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

Files with missing lines Coverage Δ
.../controller/datadogagent/component_clusteragent.go 72.61% <100.00%> (+1.01%) ⬆️
...atadogagent/feature/kubernetesstatecore/feature.go 78.76% <ø> (-0.50%) ⬇️
pkg/kubernetes/const.go 0.00% <0.00%> (ø)
...ller/datadogagent/component_clusterchecksrunner.go 76.62% <33.33%> (-1.76%) ⬇️
...adogagent/feature/kubernetesstatecore/configmap.go 95.00% <80.00%> (-2.23%) ⬇️
pkg/constants/utils.go 8.08% <0.00%> (-0.13%) ⬇️
...ler/datadogagentinternal/component_clusteragent.go 31.25% <0.00%> (-1.22%) ⬇️
...adogagentinternal/component_clusterchecksrunner.go 38.96% <0.00%> (-1.58%) ⬇️
...troller/datadogagent/controller_reconcile_agent.go 61.45% <16.66%> (-0.96%) ⬇️
...datadogagentinternal/controller_reconcile_agent.go 4.27% <0.00%> (-0.24%) ⬇️
... and 2 more

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 b4b6e01...ca228e4. Read the comment docs.

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

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants