test: add parameter fuzzing for scheduling constraints #3426
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
sebpalmerio
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)goptergenerates 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/schedulingpropertiesusesrapidto generate nodeSelector, node affinity, toleration, and resource constraints. It schedules them in memory and checks the results againstk8s.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
ExistswithNotIndrops 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 DoesNotExistare 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:
minValueswith a check that every NodeClaim keeps at leastminValuesallowed optionsHow was this change tested?
make presubmitAI Disclosure <!-- Per https://www.kubernetes.dev/docs/guide/pull-requests/#ai-guidance. Only check the boxes that apply. -->
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.