← Back to Pull requests

Define kube_config_dict schema and make it Fleet configurable in kai_scheduler and kueue #26160

Closed
unknown closed this pull request without merging on Nov 23, 2026 15:41 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 14:52 UTC
Author

What does this PR do?

<!-- Give a minimal but complete description of the change and how it works. -->

Defines the contents of kube_config_dict in the kai_scheduler and kueue config specs and makes it Fleet configurable again.

The schema declares every kubeconfig key the kubernetes==35.0.0 client reads: cluster (server, CA file/data, insecure-skip-tls-verify, tls-server-name), contexts, and users with token/tokenFile, client certificates (file/data), username/password, auth-provider (gcp, azure, oidc) and exec. token, password, client-key-data and the access-token, refresh-token, id-token and client-secret fields of auth-provider.config are marked secret, so Fleet requires secret references for them.

With properties declared, the config model is a nested pydantic model with aliased kebab-case keys, so kube_client.py now dumps it back to a kubeconfig dict (by_alias, exclude_unset) before checking whether it is empty. {} still falls back to the in-cluster config.

Motivation

<!--
Briefly explain why this change is needed and how it fits in: is it part of a bigger project, and
how does it fit into it? Are there related or follow-up PRs? Link only the references a reviewer
needs (e.g. Jira ticket, design doc, upstream docs or changelog, related PRs).
-->

Supersedes #26156, which excluded the option from Fleet because the spec declared it as a free-form object: the generated schema only accepted {} and Fleet could not treat credentials as secrets.

Trade-offs:

  • Fleet closes every declared object, and the Agent model drops undeclared keys. Keys the client ignores (preferences, proxy-url, impersonation) are dropped; Agent behavior is otherwise unchanged. Cluster extensions are kept as free-form objects because exec plugins with provideClusterInfo receive the client.authentication.k8s.io/exec extension.

  • exec is kept for parity with existing Agent configs, so Fleet can push a credential plugin command that runs on the Agent host.

  • String fields now reject non-string values, e.g. an unquoted expiry timestamp parsed by YAML as a date.
  • Follow-up: dd-source fleet-sync-worker overrides.yaml has a narrower kueue kube_config_dict override that should be removed once this merges.

    New unit tests check that every declared field reaches the Kubernetes client unchanged, undeclared keys are dropped, {} uses in-cluster config, and the real client loads token and kind-style kubeconfigs. I also ran the dd-source converter on both specs and validated sample configs against the generated schema.

    Checklist before requesting review

    <!--
    The pr-description validation (Run Validations) fails until every item below is ticked and
    the visible description (excluding HTML comments) is at most 3,000 characters. CI, the changelog,
    and the QA label have their own checks. Request review only once all checks pass:
    gh pr checks <PR> --repo DataDog/integrations-core --watch.
    -->

  • I self-reviewed the full diff, and this description matches the final change

  • <!--
    How to verify: run gh pr diff <PR> --repo DataDog/integrations-core, review every changed line,
    and compare the final diff with the description above.
    -->
  • Tests cover the change, or this description explains why none are needed

  • <!--
    How to verify: check the diff for relevant tests and run them as described in AGENTS.md.
    -->
  • Automated review comments, including Codex review, were addressed or answered

  • <!--
    How to verify: run gh api repos/DataDog/integrations-core/pulls/<PR>/comments and
    gh pr view <PR> --repo DataDog/integrations-core --json reviews,comments, then fix each
    finding or reply with the reason no change is needed.
    -->
  • I, the human author, understand this change, can explain it to reviewers, and believe it meets the repository standards

  • <!-- Coding agents: never tick this item. Only the human author may tick it. -->

    <!--
    QA label: PRs that only change code owned exclusively by @DataDog/agent-integrations (see
    .github/CODEOWNERS) always use qa/skip-qa, never qa/required.
    -->

    Diff: 530 lines (+397 / -133) across 6 files Reviewer: martavicentenavarro Review duration: 48m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.71) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.71 · 530 lines diff across 6 files
    0.71
    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.375
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.071
    Real PR Conversation Timeline
    1 comments
    "Review active on #26160"
    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: 71% (HIGH) · Higher = larger blast radius
    71%
    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: 28.1% · Safe to merge
    28.1%