← Back to Pull requests

FX-1197: Add agent config and agent profiles to the managed Agent installation intent #3753

Closed
unknown closed this pull request without merging on Nov 16, 2026 17:18 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 02:37 UTC
Author

What

Adds two optional, provider-neutral settings to the managed Agent installation intent (the ConfigMap the Fleet Daemon watches), wired into the generic provider decoder only (from #3751):

  • agentConfig — {"spec": <DatadogAgentSpec fragment>} merged over the bootstrap spec at install time. Bootstrap stays authoritative for clusterName, site, and the linux node selectors; spec.global.credentials / cluster Agent tokens are rejected, so the Fleet-delivered credentials are never overridden. The shape matches the Fleet INSTALLER_CONFIG payload and the Datadog Agent setup page's datadog-agent.yaml, so a fragment such as features.apm.instrumentation (single-step instrumentation) applies verbatim.

  • agentProfiles — DatadogAgentProfile entries (name, profileAffinity, config.spec) created next to the managed DatadogAgent, mirroring the existing Windows profile: fleet ownership labels + controller owner reference, validated against the profile allowlists (gpu, apm, hostProfiler), garbage-collected via the owner reference on uninstall, and waited on by managedAgentInstallationResourcesAbsent. When profiles are requested the DatadogAgent is annotated agent.datadoghq.com/update-metadata: "true", as required by the Agent Profiles feature.
  • Both settings participate in the intent digest (canonicalized so JSON reformatting does not change it, which keeps replay-with-different-content protection covering the config), and uninstall intents carrying them are rejected.

    The decode/merge/validate/digest logic lives in one shared finalizeManagedAgentInstallationIntent used by the generic provider decoder. EKS is intentionally untouched: its decoder keeps its existing inline logic (no agentConfig / agentProfiles on the EKS wire format, no EKS marketplace schema/template changes) and can adopt the shared finalize tail later. This PR is stacked on #3751 (fx-1127-generic-identity); merge order is #3751 first.

    Why

    MCI installs the agent with a minimal bootstrap intent, so on generic-provider clusters (Nebius, CoreWeave — the provider added in #3751) a rule cannot request GPU monitoring (GPU-nodes-only via a DatadogAgentProfile with profileNodeAffinity) or APM single-step instrumentation at install time. The only post-install remote path (update_operator config deployments) patches the DatadogAgent only and cannot address profiles or node selectors. Carrying the config in the install intent makes rule-create → install → features on, with no manual YAML.

    Note that base APM is enabled by default in the operator (defaultAPMEnabled = true), so the agentConfig path is not needed for plain APM. It is for single-step instrumentation (which is not default-on) and other non-default settings.

    Live test on a real Nebius GPU cluster (2026-11-12)

    Verified end-to-end against a Nebius managed Kubernetes GPU cluster with the generic provider:

  • Works end-to-end: intent ConfigMap → fleet daemon → DatadogAgent + gpu-nodes DatadogAgentProfile (VALID/APPLIED) → a second DaemonSet scheduled only on the GPU node, with the base DaemonSet desired count 0 on profile-matched nodes → DD_GPU_ENABLED=true, NVML detected, and gpu.* metrics (e.g. gpu.total_energy_consumption) arriving in Datadog.

  • The GPU node affinity label is cloud-specific:

  • - Nebius: nebius.com/gpu=true — not nvidia.com/gpu.present.
    - CoreWeave: gpu.nvidia.com/class / gpu.coreweave.cloud/driver-version.
    - NVIDIA GPU operator: nvidia.com/gpu.present.
    - EKS: no GPU label.

    A wrong label is a silent no-op: the profile matches 0 nodes, the base DaemonSet covers the GPU node without GPU monitoring, and the fleet state still reports DONE. Suggested follow-up: surface the matched-node count in DatadogAgentProfile status, or have the fleet daemon warn when a requested profile matches 0 nodes.

  • Nebius has no nvidia RuntimeClass (drivers are baked into the node image). Intents targeting managed-driver clouds must set features.gpu.requiredRuntimeClassName: ""; the operator default is "nvidia", which leaves the agent pods unschedulable there.

  • Install → acknowledge → uninstall was verified. Deleting the intent ConfigMap garbage-collects the state ConfigMap because it is owned by the intent ConfigMap, so Fleet must always update the intent ConfigMap in place, never delete and recreate it.

  • Nebius provider detection (#3722) works in managed-install mode: DD_KUBELET_TLS_VERIFY=false is set on all agent containers.
  • Testing

  • go test ./pkg/fleet/ -count=1 green.

  • go build ./... clean; make lint reports 0 issues.

  • Unit coverage: generic intent decode with agentConfig / agentProfiles (merge semantics, bootstrap authority, digest stability across reformatting, digest change on config change), unsafe-settings table (credentials in agentConfig / profile config, unknown fields, reserved/duplicated/invalid profile names, missing affinity, feature outside the profile allowlist, settings on uninstall), profile lifecycle (create/validate/idempotent ensure/drift rejection), uninstall waits for fleet-owned profiles, and a full installDatadogAgent with profiles asserting the update-metadata annotation and the created profile.
  • The dd-source counterpart (MCI rule install_options → intent plumbing) is ddoghq/dd-source#171714.

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: levan-m Review duration: 9521m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.75) × (1 − Review Confidence (0.57)). 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%
    56%
    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 #3753"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 32.5% · Safe to merge
    32.5%