← Back to Pull requests

[Backport v1.32] Let the Agent own PAR self-enrollment defaults #3692

Closed
unknown closed this pull request without merging on Oct 29, 2026 17:02 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 14:24 UTC
Author

Backport 72c65e857bdc281578fcde10b9c19f9ffade50cf from #3623.

___

What does this PR do?

Leave private_action_runner.self_enroll unset when omitted, so the Agent owns its runtime default rather than the Operator duplicating it.

Represent the setting as an optional boolean. Preserve explicit true and false, and omit the environment variable when unset. Provision the existing Cluster Agent enrollment-secret Role and RoleBinding unless self-enrollment or Kubernetes identity storage is explicitly disabled. The mounted configuration YAML remains unchanged.

Motivation

The Agent already defaults self-enrollment to true, but the Operator decoded an omitted value into a zero-valued Go bool. Since that value gates enrollment RBAC creation, the Operator could omit the enrollment permissions even while the Agent attempted to self-enroll.

Additional Notes

This change does not alter how PAR is enabled (annotations or Kubernetes Actions), RBAC policy contents, split mode, or node Agent configuration. File-backed identities receive no enrollment-secret Role/RoleBinding; separately enabled remediation permissions are preserved. Existing permissions may mask the mismatch in an already-configured cluster.

Companion Helm change: DataDog/helm-charts#2986. Neither integration should override an omitted Agent setting.

Minimum Agent Versions

No new minimum versions introduced. Runtime behavior for an omitted setting remains determined by the selected Agent version.

Describe your test plan

  • Regression tests cover the missing enrollment Role/RoleBinding for omitted configuration.

  • Parser coverage verifies omitted, empty and null configuration leaves self-enrollment unset, and explicit true/false remains distinguishable.

  • Environment-variable tests verify omission when unset and preservation of explicit true/false.

  • Feature tests verify Role/RoleBinding creation with default and custom secret names, absence for explicit false or file storage, unchanged mounted YAML, and preserved remediation permissions.

  • Passed: TZ=UTC go test ./internal/controller/datadogagent/feature/privateactionrunner -race -count=1.

  • Passed: go test ./internal/controller/datadogagent/feature/privateactionrunner -count=1

  • Passed: make lint (zero issues)

  • Passed: TZ=UTC go test ./... ./api/...
  • The initial full-suite run in the local timezone failed in unrelated Test_getDashboard and Test_getMonitor time-location comparisons; the UTC run passed. Subsequent live before/after QA on Kind/Kubernetes 1.34 with Cluster Agent 7.84.1 confirmed the missing-Role regression and this PR's gating fix. Fresh enrollment still encounters pre-existing secret-name/create-permission defects, addressed in stacked PR #3678; this PR alone is not an end-to-end enrollment fix. File-backed enrollment and preservation of remediation permissions were live-tested in the combined stack. The latest parent-only file-storage change was validated with regression tests, race tests, the full Go suite, and lint.

    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: 430 lines (+322 / -108) across 5 files Reviewer: dd-gplassard Review duration: 158m
    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 · 430 lines diff across 5 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.363
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #3692"
    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.1% (MEDIUM) · Higher = larger blast radius
    50.1%
    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.8% · Safe to merge
    19.8%