-
Notifications
You must be signed in to change notification settings - Fork 1
fix: treat volcano nominations as non-blocking for provisioning #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| Copyright The Kubernetes Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package scheduling | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| corev1 "k8s.io/api/core/v1" | ||
|
|
||
| "sigs.k8s.io/karpenter/pkg/scheduling" | ||
| ) | ||
|
|
||
| func TestResolveCustomLabelsFromRequirements(t *testing.T) { | ||
| nct := &NodeClaimTemplate{ | ||
| Requirements: scheduling.NewRequirements( | ||
| scheduling.NewRequirement("efa", corev1.NodeSelectorOpExists), | ||
| scheduling.NewRequirement("team", corev1.NodeSelectorOpIn, "training"), | ||
| ), | ||
| } | ||
|
|
||
| labels := nct.resolveCustomLabelsFromRequirements() | ||
|
|
||
| if value, ok := labels["efa"]; ok { | ||
| t.Fatalf("expected no label for unnarrowed Exists requirement, got efa=%q", value) | ||
| } | ||
| if labels["team"] != "training" { | ||
| t.Fatalf("expected team=training, got %v", labels) | ||
| } | ||
| } | ||
|
|
||
| func TestResolveCustomLabelsFromRequirementsNarrowedExists(t *testing.T) { | ||
| requirements := scheduling.NewRequirements(scheduling.NewRequirement("efa", corev1.NodeSelectorOpExists)) | ||
| // A pod requirement `efa In [true]` intersects the pool's `efa Exists` down to a concrete value. | ||
| requirements.Add(scheduling.NewRequirement("efa", corev1.NodeSelectorOpIn, "true")) | ||
| nct := &NodeClaimTemplate{Requirements: requirements} | ||
|
|
||
| labels := nct.resolveCustomLabelsFromRequirements() | ||
|
|
||
| if labels["efa"] != "true" { | ||
| t.Fatalf("expected efa=true from narrowed requirement, got %v", labels) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,8 +135,18 @@ func IsScheduled(pod *corev1.Pod) bool { | |
| return pod.Spec.NodeName != "" | ||
| } | ||
|
|
||
| // VolcanoSchedulerName is the schedulerName Volcano-managed pods carry. | ||
| const VolcanoSchedulerName = "volcano" | ||
|
|
||
| // IsPreempting checks if a pod is about to schedule onto existing capacity freed by preemption. | ||
| // kube-scheduler sets NominatedNodeName only after selecting preemption victims whose deletion | ||
| // will free enough capacity for the pod, and clears it when the nomination becomes invalid. | ||
| // Volcano also sets it on gang members pipelined behind an eviction while the gang as a whole | ||
| // cannot bind (minAvailable unmet), and never clears it, so for volcano-scheduled pods the field | ||
| // carries no will-soon-schedule guarantee — treating it as one deadlocks partially-satisfiable | ||
| // gangs (the nominated pods never appear provisionable, so the missing nodes are never launched). | ||
| func IsPreempting(pod *corev1.Pod) bool { | ||
| return pod.Status.NominatedNodeName != "" | ||
| return pod.Status.NominatedNodeName != "" && pod.Spec.SchedulerName != VolcanoSchedulerName | ||
|
Comment on lines
148
to
+149
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Volcano preemption still has a pre-delete race that launches an extra NodeClaim 🛑 blocking · rule The reply's simulation argument is only true after the preempted victim's Suggested fix: Do not make every Volcano nomination provisionable. Gate the exception on scheduler-specific evidence that the nomination is a gang pipeline rather than a live preemption, or defer provisioning until the nominated node's actual preemption victim is observed terminating; validate this with an end-to-end test where the nomination is observed before the victim delete. Heron review There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The duplicate-provisioning window during a genuine Volcano preemption is covered by Karpenter's own scheduling simulation rather than by this predicate: eviction sets the victim's Distinguishing "real preemption" from "gang-pipelined" nominations from pod status alone isn't possible: Volcano writes the same field in both flows ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pre-delete race window is real but bounded and accepted: it lasts from the nomination status write until the victim's The suggested gate ("defer until the victim is observed terminating") doesn't separate the cases: the gang-pipeline deadlock state also has a real evicted victim ( |
||
| } | ||
|
|
||
| func IsPending(pod *corev1.Pod) bool { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.