← Back to Pull requests

[operator] Add config value for KSM sharding #3625

Closed
unknown closed this pull request without merging on Oct 20, 2026 21:29 UTC
View on GitHub
unknown unknown commented on Oct 19, 2026 19:01 UTC
Author

What does this PR do?

Adds a KSM configuration to enable KSM sharding.

Motivation

Provide the option for large clusters to improve the scalability of the KSM check.

Minimum Agent Versions

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

  • Cluster Agent: 7.83.0
  • Describe your test plan

    Sharding enabled, cluster check runners enabled

    <details>
    <summary> Supporting configuration </summary>

    ...
    spec:
      features:
        clusterChecks:
          enabled: true
          useClusterChecksRunners: true
        kubeStateMetricsCore:
          enabled: true
          shardingEnabled: true
    ...
    

    </details>

    <details>
    <summary> Proof</summary>

    # CLUSTER AGENT SHOWS 3 SHEDULED CHECKS
    root@datadog-cluster-agent-7967f6b47c-fjlrh:/# agent clusterchecks | grep "kubernetes_state_core check" | wc -l
    3
    

    </details>

    Outcome: PASS there are 3 separate check instances scheduled.

    Sharding enabled, cluster check runners enabled, image < 7.83

    <details>
    <summary> Supporting configuration </summary>

    ...
    spec:
      features:
        clusterChecks:
          enabled: true
          useClusterChecksRunners: true
        kubeStateMetricsCore:
          enabled: true
          shardingEnabled: true
      override:
        clusterAgent:
          image:
            tag: 7.82.0 # minimum is 7.83.0
    ...
    

    </details>

    <details>
    <summary> Proof</summary>

    # OPERATOR LOGS INCLUDE ERROR
    {"level":"INFO","ts":"2026-10-19T21:18:35.965Z","logger":"controllers.DatadogAgentInternal","msg":"ShardingEnabled requires agent >= 7.83; falling back to default","namespace":"system","name":"datadog","reconcileID":"c894b6c0-a5e5-4794-9170-4f75974e7c9e","kind":"DatadogAgentInternal","version":"7.82.0"}
    

    # #A SINGLE KSM CHECK INSTANCE
    root@datadog-cluster-agent-d6dd997f7-27gl6:/# agent clusterchecks | grep "kubernetes_state_core check" | wc -l
    1
    

    </details>

    Outcome: PASS there is only one KSM check instance scheduled and the operator's logs include the configuration error.

    Sharding enabled, cluster check runners disabled

    <details>
    <summary> Supporting configuration </summary>

    ...
    spec:
      features:
        clusterChecks:
          enabled: true
          useClusterChecksRunners: false # must be true
        kubeStateMetricsCore:
          enabled: true
          shardingEnabled: true
    ...
    

    </details>

    <details>
    <summary> Proof</summary>

    # OPERATOR LOGS INCLUDE ERROR
    {"level":"INFO","ts":"2026-10-19T21:31:11.689Z","logger":"controllers.DatadogAgentInternal","msg":"ShardingEnabled requires that the KSM check runs on cluster check runners","namespace":"system","name":"datadog","reconcileID":"ac4ef96e-95b7-4707-8b64-9ae52bd4a1a8","kind":"DatadogAgentInternal"}
    

    # NO CLUSTER CHECK RUNNERS MEANS NO CLUSTER CHECKS
    root@datadog-cluster-agent-7b69556d88-6mjld:/# agent clusterchecks | grep "kubernetes_state_core check" | wc -l
    0
    
    # A SINGLE, UNSHARDED KSM INSTANCE
    root@datadog-cluster-agent-7b69556d88-6mjld:/# agent configcheck | grep "kubernetes_state_core check" | wc -l
    1
    

    </details>

    Outcome: PASS there is single KSM check instance running on the cluster agent and the operator's logs include the configuration error.

    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][1])
  • [1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

    Diff: 456 lines (+342 / -114) across 5 files Reviewer: AlexanderYastrebov Review duration: 1588m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.69) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.69 · 456 lines diff across 5 files
    0.69
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.366
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.069
    Real PR Conversation Timeline
    1 comments
    "Review active on #3625"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.7% (HIGH) · Higher = larger blast radius
    68.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.1% · Safe to merge
    27.1%