← Back to Pull requests

Let the Agent own PAR self-enrollment defaults #3623

Merged
julesmcrt merged 4 files (158 lines) on Oct 29, 2026 14:23 UTC
View on GitHub
julesmcrt julesmcrt commented on Oct 19, 2026 14:34 UTC
Author

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: 158 lines (+136 / -22) across 4 files Reviewer: dd-gplassard Review duration: 14389m
    All Vouch review confidence checks passed
    Residual risk 0.09 = Change Risk (0.43) × (1 − Review Confidence (0.78)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 158 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.67 · 3 substantive comment(s)
    0.67
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    78%
    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.303
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    7 items
    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Oct 19, 2026 14:45 UTC
    Bot

    <!-- codex-pull-request-review-summary -->
    <!-- codex-review-state:v1 {"code_review":{"commit_sha":"34b80951b5faa332c4c4f85f2cda8aa5ff9faf98","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->

    Codex Review Summary

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-10-19T14:48:43.455143Z">2026-10-19T14:48:43.455143Z</relative-time> | 34b8095 | Draft marked ready |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Oct 19, 2026 14:48 UTC
    Code Review
    internal/controller/datadogagent/feature/privateactionrunner/config.go:1
    @@ -104,13 +104,13 @@ func parsePrivateActionRunnerConfig(configData string) (*PrivateActionRunnerConf
     	config := struct {
     		PrivateActionRunner *PrivateActionRunnerConfig `yaml:"private_action_runner"`
     	}{
    -		PrivateActionRunner: &PrivateActionRunnerConfig{},
    +		PrivateActionRunner: &PrivateActionRunnerConfig{SelfEnroll: true},

    <sub><sub>!P2 Badge</sub></sub> Avoid secret RBAC when file identity storage is selected

    When self_enroll is omitted but identity_use_k8s_secret: false is explicitly configured, this default now makes SelfEnroll true, and ManageDependencies gates enrollment RBAC only on that field (feature.go:176). The resulting Role grants the Cluster Agent access to the default or configured identity Secret even though the runner is configured to persist its identity to a file; include the effective IdentityUseK8sSecret value in the RBAC condition to avoid granting unnecessary access.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Oct 19, 2026 14:48 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: 34b80951b5

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    </details>

    datadog-datadog-us1-prod[bot] datadog-datadog-us1-prod[bot] commented on Oct 19, 2026 14:49 UTC
    Bot

    <a target='_blank' href='https://app.datadoghq.com/ci/pipeline-executions?query=ci_level%3Ajob+%40git.commit.sha%3A8140a6e491b6df563543aa2b12d686f54099131e&referrer=pr-comment&start=1793227191000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok-light.svg" alt="Pipelines" align="center" /></picture></a> &nbsp;<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-operator/pull-requests/3623'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/code-coverage-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/code-coverage-ok-light.svg" alt="Code Coverage" align="center" /></picture></a>

    🎯 Code Coverage (<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-operator/pull-requests/3623'>details</a>)<br>• <strong><span title="Percentage of modified executable lines covered by tests in this PR">Patch Coverage</span></strong>: 100.00%<br>• <strong><span title="Percentage of all executable lines covered by tests in the entire codebase">Overall Coverage</span></strong>: 56.98% <span title="Change in overall coverage compared to the base branch">(+0.02%)</span><br>

    <sub>
    This comment will be updated automatically if new data arrives. <br />
    🔗 Commit SHA: 8140a6e | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
    </sub>

    dd-gplassard dd-gplassard approved these changes on Oct 19, 2026 15:24 UTC
    Approved Reviewer

    Approved these changes.

    tbavelier tbavelier approved these changes on Oct 28, 2026 10:23 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    julesmcrt julesmcrt
    Labels
    risk: low confidence: 78.3% 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.7% (MEDIUM) · Higher = larger blast radius
    42.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: 78.3% · Lower = rushed or shallow review
    78.3%
    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: 9.2% · Safe to merge
    9.2%