← Back to Pull requests

Don't require an App key to start Remote Config #3735

Closed
unknown closed this pull request without merging on Nov 18, 2026 00:07 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 20:54 UTC
Author

What does this PR do?

Lets the Operator start Remote Configuration with only an API key. Today it fails without DD_APP_KEY.

  • pkg/remoteconfig/updater.go: new RemoteConfigUpdater.SetupWithCredentials(). It loads credentials with GetCredentialsForMetadata(), which requires the API key and treats the App key as optional, then calls Setup().

  • cmd/main.go: RC is set up with rcUpdater.SetupWithCredentials(credsManager). Before, startup loaded credentials with GetCredentials(), which returns nothing unless both keys are set, and passed the result to rcUpdater.Setup(). That startup call is removed, because RC was its only consumer.

  • pkg/config/creds.go: GetCredentials() no longer serves cached API-key-only credentials. Both getters share one cache, and GetCredentialsForMetadata() can fill it without an App key. Previously GetCredentials() would then return an empty App key instead of an error. The metadata forwarder can already trigger this today, and RC would trigger it at every startup.

  • docs/remote_config.md: an App key is no longer listed as required for RC.
  • Motivation

    Remote Config authenticates with the API key alone:

  • RemoteConfigUpdater.Setup only reads creds.APIKey and passes it to service.WithAPIKey (pkg/remoteconfig/updater.go:212-253).

  • The embedded RC service only adds an App key when an RC key is configured, and the Operator never configures one.

  • Nothing in pkg/remoteconfig or pkg/fleet reads the App key.
  • The requirement came from reusing GetCredentials(), which was written for the API-backed controllers (DatadogMonitor, DatadogDashboard, DatadogSLO, DatadogGenericResource). Those still require the App key; this PR doesn't change them.

    This follows #2550, which made DD_APP_KEY optional for metadata for the same reason. It's also groundwork for using Remote Config from Fleet Automation, for example triggering Operator flares remotely, without asking customers for an App key.

    Additional Notes

  • Still env-only. RC reads only DD_API_KEY from the Operator's environment. Using GetCredsWithDDAFallback() so RC also works when the key only lives in the DatadogAgent CR is a possible follow-up. It isn't included here.

  • Secret refresh. With no App key, the secret refresh routine (Refresh() → fetchCredentials()) still requires both keys and keeps the cached credentials when it fails. That's unchanged, and RC doesn't re-read credentials after setup anyway.

  • Other docs. The Operator Helm chart also says RC "Requires clusterName, API and App keys" (charts/datadog-operator/values.yaml:111 and the README in DataDog/helm-charts). It needs a follow-up there once this ships.

  • Draft. This is a draft so the fix can be tested further, and so the owners can confirm the App key was never needed for RC.
  • Minimum Agent Versions

    None. This change is only in the Operator.

    Agent: n/a
    Cluster Agent: n/a

    Describe your test plan

    Unit tests. go test ./pkg/config/ ./pkg/remoteconfig/ passes.

  • Two new Test_getCredentials cases cover cached API-key-only credentials. Both fail without the creds.go change.

  • New TestSetupWithCredentials covers four cases: API key only, API key and App key, a credentials error, and an empty API key. SetupWithCredentials and GetCredentials are both at 100% coverage.

  • golangci-lint v2.15.0 reports 0 issues on ./cmd/..., ./pkg/config/... and ./pkg/remoteconfig/....
  • Manual tests. I ran these on a local kind cluster with RC enabled (-remoteConfigEnabled=true), with only DD_API_KEY set and DD_APP_KEY unset, against config.datadoghq.com:

    | Build | Result |
    |---|---|
    | Released v1.31.2 (chart 2.31.0) | ❌ Unable to get credentials: empty API key and/or App key, then Unable to set up Remote Config service: error obtaining API key |
    | main (0332fa28) | ❌ Same two errors, and no RC database is created |
    | This branch | ✅ Remote Configuration service started / client started. The AGENT_CONFIG callback fires about 1s later. The RC database contains the fetched director targets, the full root chain and the backend state. |

    I also called the RC backend directly with the same api.HTTPClient and only an API key:

  • An RC-enabled API key is authorized and fetches configs.

  • A bogus key gets a 401 asking for "the Remote Config scope".
  • So the backend checks the API key's RC scope, not the App key.

    The local runs of main and this branch used the binary outside the cluster, with leader election disabled. The released build ran from the chart inside the cluster.

    Not tested: Fleet rollouts (UPDATER_TASK), encrypted ENC[...] keys through the secret backend, and sites other than US1.

    To reproduce: install with remoteConfiguration.enabled=true and apiKeyExistingSecret set, and without appKey or appKeyExistingSecret. Then check the Operator logs for Remote Configuration client started and the absence of Unable to set up Remote Config service.

    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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: Mathew-Estafanous Review duration: 17472m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.75) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #3735"
    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: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    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: 29.7% · Safe to merge
    29.7%