← Back to Pull requests

test: add parameter fuzzing for scheduling constraints #3426

Closed
unknown closed this pull request without merging on Oct 20, 2026 21:21 UTC
View on GitHub
unknown unknown commented on Oct 14, 2026 16:57 UTC
Author

Fixes #N/A

Reviewed in my fork: https://github.com/sebpalmerio/karpenter/pull/9

tldr


Goal: catch scheduling-constraint bugs, where Karpenter ignores a pod it could serve or launches a node the pod can't land on, before they ship.

How it works:
1. ~rapid~ (swapped for) gopter generates random pod constraints from the labels a launchable node would carry.
2. Karpenter's real scheduler places the pods in memory.
3. Each NodeClaim goes through the provider's Launch.
4. Every placement is checked against k8s.io/component-helpers.

Properties:

  • ExpectSatisfiablePodsArePlaced: satisfiable pods are never rejected or left unplaced.

  • ExpectPlacementsFitNodes: every placement fits its node.
  • Providers run the same checks with their own labels through Config. The seed is pinned, so CI runs are deterministic and take a few seconds.

    Description


    Adds parameter fuzzing for pod scheduling constraints. pkg/test/schedulingproperties uses rapid to generate nodeSelector, node affinity, toleration, and resource constraints. It schedules them in memory and checks the results against k8s.io/component-helpers:
  • ExpectSatisfiablePodsArePlaced: every pod that a launchable node satisfies is accepted and placed.

  • ExpectPlacementsFitNodes: every placement fits the launched node.
  • Providers can run the same checks with their own instance types and labels through Config.

    Findings.


    The generator avoids these until they're fixed:
    1. Pods selecting the NodeClass label are rejected when the provider restricts its domain (#3422).
    2. Contradictory requirements on one key collapse to DoesNotExist, so Karpenter launches a node the pod can't bind to (#3423).
    3. Intersecting Exists with NotIn drops existence, so a pod can land on a node without a label it requires (#3425).
    4. Required terms are relaxed before preferred terms, so an unsatisfiable preference discards a satisfiable required term (#3424).
    5. Pods whose constraints reduce to nodepool DoesNotExist are ignored as opting out of Karpenter (#1265).
    6. One required term with an invalid value rejects the pod, even if another OR'd term is valid (#2230).

    Follow-ups:


  • Metamorphic checks

  • Topology spread and pod (anti-)affinity

  • Volume topology and host ports

  • NodePool minValues with a check that every NodeClaim keeps at least minValues allowed options
  • How was this change tested?

  • New Ginkgo specs in the scheduling suite, run against the fake provider with its domain restricted.

  • Passes at 1,000 checks on several seeds.

  • make presubmit
  • AI Disclosure <!-- Per https://www.kubernetes.dev/docs/guide/pull-requests/#ai-guidance. Only check the boxes that apply. -->

  • I used AI assistance to help produce this contribution.

  • I have verified the AI generated code prior to submission.

  • I will engage with review comments directly and will not use AI to write my replies.
  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    Diff: 387 lines (+290 / -97) across 4 files Reviewer: sebpalmerio Review duration: 8904m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 387 lines diff across 4 files
    0.43
    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.357
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3426"
    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: 43% (MEDIUM) · Higher = larger blast radius
    43%
    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: 17% · Safe to merge
    17%