← Back to Pull requests

feat(ksm): grant DRA RBAC for Cluster Agent 7.85.0+; mount CDI dir for GPU monitoring #3703

Closed
unknown closed this pull request without merging on Nov 02, 2026 21:19 UTC
View on GitHub
unknown unknown commented on Oct 30, 2026 19:33 UTC
Author

What does this PR do?

  • When the component running kubernetes_state_core (Cluster Agent, or Cluster Checks Runner when KSM runs there) is 7.85.0+, adds a resource.k8s.io list/watch rule for resourceclaims, resourceslices and devicetaintrules to the KSM ClusterRole. The operator's own ClusterRole gets the same permissions so it can grant them.

  • With GPU monitoring enabled, mounts host /var/run/cdi read-only at /host/var/run/cdi in the core agent container. The mount is removed on GKE Autopilot.

  • Documents in docs/kubernetes_state_metrics.md how to enable DRA collection through conf.configData.
  • Motivation

    Cluster Agent 7.85.0 collects Kubernetes DRA metrics when users add the resourceclaims, resourceslices and devicetaintrules collectors to a custom KSM config. Users can add the collectors themselves but can't grant the RBAC. The CDI specs let the node agent attribute GPUs to pods that got them through DRA.

    Example

    examples/datadogagent/datadog-agent-with-dra.yaml shows a working setup: Cluster Agent and Agent image overrides to 7.85.0, features.gpu.enabled: true, and kubeStateMetricsCore.conf.configData with the full default collector list plus resourceclaims, resourceslices, devicetaintrules (and an optional dra_device_classes filter).

    Additional Notes

  • The operator does not add the collectors and there is no new CRD field.

  • The version check fails closed (unparseable tags such as :dev get no rule): a Cluster Agent older than 7.85 fails the whole kubernetes_state_core check on DRA clusters when given these collector names.

  • With no image override, the check uses the bundled Cluster Agent version (currently 7.84.1), so the rule is only added once the bundle moves to 7.85+, or when users set a 7.85+ image.
  • Minimum Agent Versions

    Agent: none (older agents ignore the CDI mount)
    Cluster Agent: v7.85.0 (Cluster Checks Runner v7.85.0 when KSM runs there)

    Describe your test plan

    Unit tests cover the RBAC version check (Cluster Agent and Cluster Checks Runner, rc and :dev tags, no override, custom conf) and the CDI mount including the Autopilot removal. make gotest, make golden-test and make lint pass; make generate && make manifests leaves no diff.

    To check on a cluster: set the Cluster Agent image to 7.85.0+, add the three collectors through features.kubeStateMetricsCore.conf.configData, and confirm kubernetes_state.resourceslice.devices reports with no Forbidden errors in the Cluster Agent logs.

    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: 377 lines (+282 / -95) across 4 files Reviewer: tbavelier Review duration: 4426m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 377 lines diff across 4 files
    0.43
    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.355
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3703"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 42.9% (MEDIUM) · Higher = larger blast radius
    42.9%
    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: 16.9% · Safe to merge
    16.9%