← Back to Pull requests

[CONS-11950] Apply global.registry to the managed CSI driver image #3486

Closed
unknown closed this pull request without merging on Sep 23, 2026 19:38 UTC
View on GitHub
unknown unknown commented on Sep 18, 2026 08:22 UTC
Author

What does this PR do?

Makes spec.global.registry apply to the Datadog CSI driver image that the operator manages.

  • Adds spec.registry to DatadogCSIDriverSpec, propagated by the DatadogAgent controller from the (already defaulted) spec.global.registry.

  • Adds spec.global.csi.image (a dedicated CSIImageConfig: name, tag, pullPolicy, pullSecrets), propagated to spec.csiDriverImage, so those work while keeping autoManage: true. It deliberately does not reuse AgentImageConfig, whose jmxEnabled only applies to the Agent image — there is no csi-driver:<tag>-jmx, so offering the knob could only resolve to a tag that does not exist.

  • Wires imagePullPolicy from both image specs into the DaemonSet containers. The CRD accepted the field but nothing ever read it.

  • Includes registrarImage.pullSecrets in the pod's imagePullSecrets. Only the driver's secrets were used, so a relocated registrar could not authenticate.

  • Keeps GKE Autopilot on GCR in resolveCSIDriverImage, using the existing images.IsGCRRegistry, so moving the default off hardcoded GCR does not break the Autopilot WorkloadAllowlist.
  • Motivation

    CONS-11950 (FR: FRCONS-1268).

    spec.global.registry is the documented single place a customer points a DatadogAgent at another container registry, and it already redirects every Agent image plus the Single Step Instrumentation injection images. The CSI driver ignored it: resolveCSIDriverImage hardcoded gcr.io/datadoghq. A customer on a private or mirrored registry who set global.csi.enabled: true got the CSI DaemonSet in ImagePullBackOff against an egress destination their environment blocks by design, with nothing in the docs explaining why.

    The only workaround was to opt out of operator management entirely (autoManage: false) and hand-own the DatadogCSIDriver CR with full registry/name:tag image names, because the operator reverts any image edit on the CR it manages.

    Additional Notes

    Reading this diff. It is ~760 added lines, but only 132 are hand-written source. The split:

    | | Lines |
    |---|---|
    | Generated (config/crd/*, zz_generated., docs/configuration.md) | ~400 |
    | Tests | ~230 |
    | Hand-written source | ~132 |

    Most of the generated bulk is one 48-line CRD block for global.csi.image, replicated across 3 CRDs x 2 formats because GlobalConfig is embedded in DatadogAgent, DatadogAgentInternal and DatadogAgentProfile. Reviewing internal/, api//_types.go and the tests covers everything of substance; the rest is make generate && make manifests output.

    The global.registry field documentation is updated to say it covers Agent images, SSI injection images and the CSI driver image.

    Minimum Agent Versions

    None. This only changes which registry the operator resolves images from.

    Agent: n/a
    Cluster Agent: n/a

    Describe your test plan

    Unit tests (go test ./...) and make lint pass. New coverage:

  • internal/controller/datadogcsidriver: TestResolveImages_Registry tables the registry/override precedence (registry only, empty registry, tag-only override, full registry/name:tag override winning, registrar unaffected, and the three Autopilot rows); TestBuildDaemonSet_ImagePullPolicy and TestBuildDaemonSet_RegistrarImagePullSecrets pin the two newly-honored fields, the latter also asserting the DD_APM_REGISTRY_AUTH_* fallback still uses driver secrets only.

  • internal/controller/datadogagent: TestReconcileDatadogCSIDriver_ImageConfigPropagated and _ImageConfigIsCopied cover propagation and that the built CR does not alias the DDA.
  • Manual, with the operator started with --datadogCSIDriverEnabled=true:

    1. DatadogAgent with global.registry: <mirror> and global.csi.enabled: true → kubectl get ddcsi <name> -o jsonpath='{.spec.registry}' returns the mirror, and the DaemonSet shows <mirror>/csi-driver:1.4.0 with the registrar unchanged on registry.k8s.io/sig-storage.
    2. No global.registry → registry.datadoghq.com/csi-driver:1.4.0.
    3. Set global.csi.image.pullSecrets → the pod template's imagePullSecrets appears.
    4. Change global.registry on the DDA → the CR and the DaemonSet converge on the next reconcile.

    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

    🤖 Generated with Claude Code

    [CONS-11950]: https://datadoghq.atlassian.net/browse/CONS-11950?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

    Diff: 622 lines (+466 / -156) across 7 files Reviewer: clamoriniere Review duration: 7876m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 622 lines diff across 7 files
    0.50
    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.385
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3486"
    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: 50.3% (MEDIUM) · Higher = larger blast radius
    50.3%
    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: 19.9% · Safe to merge
    19.9%