mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 22:40:35 +00:00
scheduler: Added logger parameter to signPod in scheduling_queue.go
This commit is contained in:
@@ -738,7 +738,7 @@ func (p *PriorityQueue) Add(ctx context.Context, logger klog.Logger, pod *v1.Pod
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
pInfo := p.newQueuedPodInfo(ctx, pod)
|
||||
pInfo := p.newQueuedPodInfo(ctx, logger, pod)
|
||||
if added := p.moveToActiveQ(logger, pInfo, framework.EventUnscheduledPodAdd.Label(), false); added {
|
||||
p.activeQ.broadcast()
|
||||
}
|
||||
@@ -1126,14 +1126,16 @@ func (p *PriorityQueue) Update(ctx context.Context, logger klog.Logger, oldPod,
|
||||
oldPodInfo := newQueuedPodInfoForLookup(oldPod)
|
||||
// If the pod is already in the active queue, just update it there.
|
||||
if pInfo := unlockedActiveQ.update(newPod, oldPodInfo); pInfo != nil {
|
||||
p.updateNominatedPodAndSignature(ctx, logger, pInfo, oldPod, newPod)
|
||||
p.UpdateNominatedPod(logger, oldPod, pInfo.PodInfo)
|
||||
pInfo.PodSignature = p.signPod(ctx, logger, newPod)
|
||||
updated = true
|
||||
return
|
||||
}
|
||||
|
||||
// If the pod is in the backoff queue, update it there.
|
||||
if pInfo := p.backoffQ.update(newPod, oldPodInfo); pInfo != nil {
|
||||
p.updateNominatedPodAndSignature(ctx, logger, pInfo, oldPod, newPod)
|
||||
p.UpdateNominatedPod(logger, oldPod, pInfo.PodInfo)
|
||||
pInfo.PodSignature = p.signPod(ctx, logger, newPod)
|
||||
updated = true
|
||||
return
|
||||
}
|
||||
@@ -1146,7 +1148,8 @@ func (p *PriorityQueue) Update(ctx context.Context, logger klog.Logger, oldPod,
|
||||
// If the pod is in the unschedulable queue, updating it may make it schedulable.
|
||||
if pInfo := p.unschedulablePods.get(newPod); pInfo != nil {
|
||||
_ = pInfo.Update(newPod)
|
||||
p.updateNominatedPodAndSignature(ctx, logger, pInfo, oldPod, newPod)
|
||||
p.UpdateNominatedPod(logger, oldPod, pInfo.PodInfo)
|
||||
pInfo.PodSignature = p.signPod(ctx, logger, newPod)
|
||||
|
||||
if p.isSchedulingQueueHintEnabled {
|
||||
// When unscheduled Pods are updated, we check with QueueingHint
|
||||
@@ -1190,7 +1193,7 @@ func (p *PriorityQueue) Update(ctx context.Context, logger klog.Logger, oldPod,
|
||||
return
|
||||
}
|
||||
// If pod is not in any of the queues, we put it in the active queue.
|
||||
pInfo := p.newQueuedPodInfo(ctx, newPod)
|
||||
pInfo := p.newQueuedPodInfo(ctx, logger, newPod)
|
||||
if added := p.moveToActiveQ(logger, pInfo, framework.EventUnscheduledPodUpdate.Label(), false); added {
|
||||
p.activeQ.broadcast()
|
||||
}
|
||||
@@ -1245,12 +1248,6 @@ func (p *PriorityQueue) AssignedPodUpdated(logger klog.Logger, oldPod, newPod *v
|
||||
p.lock.Unlock()
|
||||
}
|
||||
|
||||
// updateNominatedPodAndSignature updates the nominated pod and recomputes the signature.
|
||||
func (p *PriorityQueue) updateNominatedPodAndSignature(ctx context.Context, logger klog.Logger, pInfo *framework.QueuedPodInfo, oldPod, newPod *v1.Pod) {
|
||||
p.UpdateNominatedPod(logger, oldPod, pInfo.PodInfo)
|
||||
pInfo.PodSignature = p.signPod(ctx, newPod)
|
||||
}
|
||||
|
||||
// NOTE: this function assumes a lock has been acquired in the caller.
|
||||
// moveAllToActiveOrBackoffQueue moves all pods from unschedulablePods to activeQ or backoffQ.
|
||||
// This function adds all pods and then signals the condition variable to ensure that
|
||||
@@ -1514,9 +1511,7 @@ func (p *PriorityQueue) NominatedPodsForNode(nodeName string) []fwk.PodInfo {
|
||||
|
||||
// signPod computes the scheduling signature for the given pod when OpportunisticBatching is enabled.
|
||||
// The signature is used to cache and reuse scheduling results for identical pods.
|
||||
func (p *PriorityQueue) signPod(ctx context.Context, pod *v1.Pod) fwk.PodSignature {
|
||||
logger := klog.FromContext(ctx)
|
||||
|
||||
func (p *PriorityQueue) signPod(ctx context.Context, logger klog.Logger, pod *v1.Pod) fwk.PodSignature {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.OpportunisticBatching) {
|
||||
return nil
|
||||
}
|
||||
@@ -1537,7 +1532,7 @@ func (p *PriorityQueue) signPod(ctx context.Context, pod *v1.Pod) fwk.PodSignatu
|
||||
}
|
||||
|
||||
// newQueuedPodInfo builds a QueuedPodInfo object.
|
||||
func (p *PriorityQueue) newQueuedPodInfo(ctx context.Context, pod *v1.Pod, plugins ...string) *framework.QueuedPodInfo {
|
||||
func (p *PriorityQueue) newQueuedPodInfo(ctx context.Context, logger klog.Logger, pod *v1.Pod, plugins ...string) *framework.QueuedPodInfo {
|
||||
now := p.clock.Now()
|
||||
// ignore this err since apiserver doesn't properly validate affinity terms
|
||||
// and we can't fix the validation for backwards compatibility.
|
||||
@@ -1546,7 +1541,7 @@ func (p *PriorityQueue) newQueuedPodInfo(ctx context.Context, pod *v1.Pod, plugi
|
||||
PodInfo: podInfo,
|
||||
Timestamp: now,
|
||||
InitialAttemptTimestamp: nil,
|
||||
PodSignature: p.signPod(ctx, pod),
|
||||
PodSignature: p.signPod(ctx, logger, pod),
|
||||
UnschedulablePlugins: sets.New(plugins...),
|
||||
NeedsPodGroupScheduling: p.isGenericWorkloadEnabled && pod.Spec.SchedulingGroup != nil,
|
||||
}
|
||||
|
||||
@@ -1118,13 +1118,13 @@ func TestPriorityQueue_Pop(t *testing.T) {
|
||||
// Add medium priority pod to the activeQ
|
||||
q.Add(ctx, logger, medPriorityPodInfo.Pod)
|
||||
// Add high priority pod to the backoffQ
|
||||
backoffPodInfo := q.newQueuedPodInfo(ctx, highPriorityPodInfo.Pod, "plugin")
|
||||
backoffPodInfo := q.newQueuedPodInfo(ctx, logger, highPriorityPodInfo.Pod, "plugin")
|
||||
q.backoffQ.add(logger, backoffPodInfo, framework.EventUnscheduledPodAdd.Label())
|
||||
// Add high priority pod to the errorBackoffQ
|
||||
errorBackoffPodInfo := q.newQueuedPodInfo(ctx, highPriorityPodInfo2.Pod)
|
||||
errorBackoffPodInfo := q.newQueuedPodInfo(ctx, logger, highPriorityPodInfo2.Pod)
|
||||
q.backoffQ.add(logger, errorBackoffPodInfo, framework.EventUnscheduledPodAdd.Label())
|
||||
// Add pod to the unschedulablePods
|
||||
unschedulablePodInfo := q.newQueuedPodInfo(ctx, unschedulablePodInfo.Pod, "plugin")
|
||||
unschedulablePodInfo := q.newQueuedPodInfo(ctx, logger, unschedulablePodInfo.Pod, "plugin")
|
||||
q.unschedulablePods.addOrUpdate(unschedulablePodInfo, false, framework.EventUnscheduledPodAdd.Label())
|
||||
|
||||
var gotPods []string
|
||||
@@ -1207,7 +1207,7 @@ func TestPriorityQueue_Update(t *testing.T) {
|
||||
name: "When updating a pod that is in backoff queue and is still backing off, it will be updated in backoff queue",
|
||||
wantQ: backoffQ,
|
||||
prepareFunc: func(ctx context.Context, t *testing.T, logger klog.Logger, q *PriorityQueue) (oldPod, newPod *v1.Pod) {
|
||||
podInfo := q.newQueuedPodInfo(ctx, medPriorityPodInfo.Pod)
|
||||
podInfo := q.newQueuedPodInfo(ctx, logger, medPriorityPodInfo.Pod)
|
||||
q.backoffQ.add(logger, podInfo, framework.EventUnscheduledPodAdd.Label())
|
||||
return podInfo.Pod, podInfo.Pod
|
||||
},
|
||||
@@ -1217,7 +1217,7 @@ func TestPriorityQueue_Update(t *testing.T) {
|
||||
name: "when updating a pod in unschedulablePods, if its backoff timer has not yet expired, it moves to backoffQ",
|
||||
wantQ: backoffQ,
|
||||
prepareFunc: func(ctx context.Context, t *testing.T, logger klog.Logger, q *PriorityQueue) (oldPod, newPod *v1.Pod) {
|
||||
pInfo := q.newQueuedPodInfo(ctx, medPriorityPodInfo.Pod, queuePlugin)
|
||||
pInfo := q.newQueuedPodInfo(ctx, logger, medPriorityPodInfo.Pod, queuePlugin)
|
||||
// needs to increment to make the pod backing off
|
||||
pInfo.UnschedulableCount++
|
||||
q.unschedulablePods.addOrUpdate(pInfo, false, framework.EventUnscheduledPodAdd.Label())
|
||||
@@ -1231,7 +1231,7 @@ func TestPriorityQueue_Update(t *testing.T) {
|
||||
name: "when updating a pod in unschedulablePods, if its backoff timer has expired, it moves to activeQ",
|
||||
wantQ: activeQ,
|
||||
prepareFunc: func(ctx context.Context, t *testing.T, logger klog.Logger, q *PriorityQueue) (oldPod, newPod *v1.Pod) {
|
||||
pInfo := q.newQueuedPodInfo(ctx, medPriorityPodInfo.Pod, queuePlugin)
|
||||
pInfo := q.newQueuedPodInfo(ctx, logger, medPriorityPodInfo.Pod, queuePlugin)
|
||||
// needs to increment to make the pod backing off
|
||||
pInfo.UnschedulableCount++
|
||||
q.unschedulablePods.addOrUpdate(pInfo, false, framework.EventUnscheduledPodAdd.Label())
|
||||
@@ -1248,7 +1248,7 @@ func TestPriorityQueue_Update(t *testing.T) {
|
||||
name: "when updating a pod in unschedulablePods, if the scheduling hint returns QueueSkip, it remains in unschedulablePods",
|
||||
wantQ: unschedulableQ,
|
||||
prepareFunc: func(ctx context.Context, t *testing.T, logger klog.Logger, q *PriorityQueue) (oldPod, newPod *v1.Pod) {
|
||||
q.unschedulablePods.addOrUpdate(q.newQueuedPodInfo(ctx, medPriorityPodInfo.Pod, skipPlugin), false, framework.EventUnscheduledPodAdd.Label())
|
||||
q.unschedulablePods.addOrUpdate(q.newQueuedPodInfo(ctx, logger, medPriorityPodInfo.Pod, skipPlugin), false, framework.EventUnscheduledPodAdd.Label())
|
||||
updatedPod := medPriorityPodInfo.Pod.DeepCopy()
|
||||
updatedPod.Annotations["foo"] = "test1"
|
||||
return medPriorityPodInfo.Pod, updatedPod
|
||||
@@ -1694,7 +1694,7 @@ func TestPriorityQueue_moveToActiveQ(t *testing.T) {
|
||||
}
|
||||
q := NewTestQueueWithObjects(ctx, newDefaultQueueSort(), []runtime.Object{tt.pod}, WithPreEnqueuePluginMap(m),
|
||||
WithPodInitialBackoffDuration(time.Second*30), WithPodMaxBackoffDuration(time.Second*60))
|
||||
got := q.moveToActiveQ(logger, q.newQueuedPodInfo(ctx, tt.pod), tt.event, tt.movesFromBackoffQ)
|
||||
got := q.moveToActiveQ(logger, q.newQueuedPodInfo(ctx, logger, tt.pod), tt.event, tt.movesFromBackoffQ)
|
||||
if got != tt.wantSuccess {
|
||||
t.Errorf("Unexpected result: want %v, but got %v", tt.wantSuccess, got)
|
||||
}
|
||||
@@ -1790,7 +1790,7 @@ func TestPriorityQueue_moveToBackoffQ(t *testing.T) {
|
||||
}
|
||||
q := NewTestQueueWithObjects(ctx, newDefaultQueueSort(), []runtime.Object{tt.pod}, WithPreEnqueuePluginMap(m),
|
||||
WithPodInitialBackoffDuration(time.Second*30), WithPodMaxBackoffDuration(time.Second*60))
|
||||
pInfo := q.newQueuedPodInfo(ctx, tt.pod)
|
||||
pInfo := q.newQueuedPodInfo(ctx, logger, tt.pod)
|
||||
got := q.moveToBackoffQ(logger, pInfo, framework.EventUnscheduledPodAdd.Label())
|
||||
if got != tt.wantSuccess {
|
||||
t.Errorf("Unexpected result: want %v, but got %v", tt.wantSuccess, got)
|
||||
@@ -1910,13 +1910,13 @@ func BenchmarkMoveAllToActiveOrBackoffQueue(b *testing.B) {
|
||||
// - in random case, each pod failed by a random plugin, and also the moveEvent
|
||||
// is randomized.
|
||||
if tt.name == "baseline" {
|
||||
podInfo = q.newQueuedPodInfo(ctx, p)
|
||||
podInfo = q.newQueuedPodInfo(ctx, logger, p)
|
||||
} else if tt.name == "worst" {
|
||||
// Each pod failed by all plugins.
|
||||
podInfo = q.newQueuedPodInfo(ctx, p, plugins...)
|
||||
podInfo = q.newQueuedPodInfo(ctx, logger, p, plugins...)
|
||||
} else {
|
||||
// Random case.
|
||||
podInfo = q.newQueuedPodInfo(ctx, p, plugins[j%len(plugins)])
|
||||
podInfo = q.newQueuedPodInfo(ctx, logger, p, plugins[j%len(plugins)])
|
||||
}
|
||||
err := q.AddUnschedulableIfNotPresent(logger, podInfo, q.SchedulingCycle())
|
||||
if err != nil {
|
||||
@@ -2082,11 +2082,11 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueue(t *testing.T) {
|
||||
t.Errorf("Unexpected pod after Pop (-want, +got):\n%s", diff)
|
||||
}
|
||||
expectInFlightPods(t, q, unschedulablePodInfo.Pod.UID, highPriorityPodInfo.Pod.UID)
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, unschedulablePodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, unschedulablePodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, highPriorityPodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, highPriorityPodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -2101,7 +2101,7 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueue(t *testing.T) {
|
||||
}
|
||||
expectInFlightPods(t, q, hpp1.UID)
|
||||
// This Pod will go to backoffQ because no failure plugin is associated with it.
|
||||
hpp1PodInfo := q.newQueuedPodInfo(ctx, hpp1)
|
||||
hpp1PodInfo := q.newQueuedPodInfo(ctx, logger, hpp1)
|
||||
hpp1PodInfo.UnschedulableCount++
|
||||
err = q.AddUnschedulableIfNotPresent(logger, hpp1PodInfo, q.SchedulingCycle())
|
||||
if err != nil {
|
||||
@@ -2118,7 +2118,7 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueue(t *testing.T) {
|
||||
}
|
||||
expectInFlightPods(t, q, hpp2.UID)
|
||||
// This Pod will go to the unschedulable Pod pool.
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, hpp2, "barPlugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, hpp2, "barPlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -2168,9 +2168,9 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueue(t *testing.T) {
|
||||
} else if diff := cmp.Diff(hpp1, p.Pod); diff != "" {
|
||||
t.Errorf("Unexpected pod after Pop (-want, +got):\n%s", diff)
|
||||
}
|
||||
unschedulableQueuedPodInfo := q.newQueuedPodInfo(ctx, unschedulablePodInfo.Pod, "fooPlugin")
|
||||
highPriorityQueuedPodInfo := q.newQueuedPodInfo(ctx, highPriorityPodInfo.Pod, "fooPlugin")
|
||||
hpp1QueuedPodInfo := q.newQueuedPodInfo(ctx, hpp1)
|
||||
unschedulableQueuedPodInfo := q.newQueuedPodInfo(ctx, logger, unschedulablePodInfo.Pod, "fooPlugin")
|
||||
highPriorityQueuedPodInfo := q.newQueuedPodInfo(ctx, logger, highPriorityPodInfo.Pod, "fooPlugin")
|
||||
hpp1QueuedPodInfo := q.newQueuedPodInfo(ctx, logger, hpp1)
|
||||
expectInFlightPods(t, q, medPriorityPodInfo.Pod.UID, unschedulablePodInfo.Pod.UID, highPriorityPodInfo.Pod.UID, hpp1.UID)
|
||||
err = q.AddUnschedulableIfNotPresent(logger, unschedulableQueuedPodInfo, q.SchedulingCycle())
|
||||
if err != nil {
|
||||
@@ -2239,18 +2239,18 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueueWithoutQueueingHint(t *testi
|
||||
// To simulate the pod is failed in scheduling in the real world, Pop() the pod from activeQ before AddUnschedulableIfNotPresent()s below.
|
||||
q.Add(ctx, logger, medPriorityPodInfo.Pod)
|
||||
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, unschedulablePodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, unschedulablePodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, highPriorityPodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, highPriorityPodInfo.Pod, "fooPlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
// Construct a Pod, but don't associate its scheduler failure to any plugin
|
||||
hpp1 := clonePod(highPriorityPodInfo.Pod, "hpp1")
|
||||
// This Pod will go to backoffQ because no failure plugin is associated with it.
|
||||
hpp1PodInfo := q.newQueuedPodInfo(ctx, hpp1)
|
||||
hpp1PodInfo := q.newQueuedPodInfo(ctx, logger, hpp1)
|
||||
hpp1PodInfo.UnschedulableCount++
|
||||
err = q.AddUnschedulableIfNotPresent(logger, hpp1PodInfo, q.SchedulingCycle())
|
||||
if err != nil {
|
||||
@@ -2259,7 +2259,7 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueueWithoutQueueingHint(t *testi
|
||||
// Construct another Pod, and associate its scheduler failure to plugin "barPlugin".
|
||||
hpp2 := clonePod(highPriorityPodInfo.Pod, "hpp2")
|
||||
// This Pod will go to the unschedulable Pod pool.
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, hpp2, "barPlugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, hpp2, "barPlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -2285,9 +2285,9 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueueWithoutQueueingHint(t *testi
|
||||
c.Step(q.backoffQ.podMaxBackoffDuration())
|
||||
_ = q.backoffQ.popAllBackoffCompleted(logger)
|
||||
|
||||
unschedulableQueuedPodInfo := q.newQueuedPodInfo(ctx, unschedulablePodInfo.Pod, "fooPlugin")
|
||||
highPriorityQueuedPodInfo := q.newQueuedPodInfo(ctx, highPriorityPodInfo.Pod, "fooPlugin")
|
||||
hpp1QueuedPodInfo := q.newQueuedPodInfo(ctx, hpp1)
|
||||
unschedulableQueuedPodInfo := q.newQueuedPodInfo(ctx, logger, unschedulablePodInfo.Pod, "fooPlugin")
|
||||
highPriorityQueuedPodInfo := q.newQueuedPodInfo(ctx, logger, highPriorityPodInfo.Pod, "fooPlugin")
|
||||
hpp1QueuedPodInfo := q.newQueuedPodInfo(ctx, logger, hpp1)
|
||||
err = q.AddUnschedulableIfNotPresent(logger, unschedulableQueuedPodInfo, q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
@@ -2443,7 +2443,7 @@ func TestPriorityQueue_AssignedPodAdded_(t *testing.T) {
|
||||
t.Errorf("Unexpected pod after Pop (-want, +got):\n%s", diff)
|
||||
}
|
||||
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, tt.unschedPod, tt.unschedPlugin), q.SchedulingCycle())
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, tt.unschedPod, tt.unschedPlugin), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -2559,7 +2559,7 @@ func TestPriorityQueue_AssignedPodUpdated(t *testing.T) {
|
||||
t.Errorf("Unexpected pod after Pop (-want, +got):\n%s", diff)
|
||||
}
|
||||
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, tt.unschedPod, tt.unschedPlugin), q.SchedulingCycle())
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, tt.unschedPod, tt.unschedPlugin), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -2684,11 +2684,11 @@ func TestPriorityQueue_PendingPods(t *testing.T) {
|
||||
t.Errorf("Unexpected pod after Pop (-want, +got):\n%s", diff)
|
||||
}
|
||||
q.Add(ctx, logger, medPriorityPodInfo.Pod)
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, unschedulablePodInfo.Pod, "plugin"), q.SchedulingCycle())
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, unschedulablePodInfo.Pod, "plugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, highPriorityPodInfo.Pod, "plugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, highPriorityPodInfo.Pod, "plugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -3068,11 +3068,11 @@ func TestHighPriorityFlushUnschedulablePodsLeftover(t *testing.T) {
|
||||
} else if diff := cmp.Diff(midPod, p.Pod); diff != "" {
|
||||
t.Errorf("Unexpected pod after Pop (-want, +got):\n%s", diff)
|
||||
}
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, highPod, "fakePlugin"), q.SchedulingCycle())
|
||||
err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, highPod, "fakePlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, midPod, "fakePlugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, midPod, "fakePlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -3116,7 +3116,7 @@ func TestFlushUnschedulablePodsLeftoverSetsFlag(t *testing.T) {
|
||||
}
|
||||
|
||||
// Add pod to unschedulablePods (simulating failed scheduling)
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, pod, "fakePlugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, pod, "fakePlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -3135,7 +3135,7 @@ func TestFlushUnschedulablePodsLeftoverSetsFlag(t *testing.T) {
|
||||
}
|
||||
|
||||
// Simulate pod failing to schedule again and returning to queue
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, pInfo.Pod, "fakePlugin"), q.SchedulingCycle())
|
||||
err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(ctx, logger, pInfo.Pod, "fakePlugin"), q.SchedulingCycle())
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error from AddUnschedulableIfNotPresent: %v", err)
|
||||
}
|
||||
@@ -4975,7 +4975,8 @@ func TestPriorityQueue_signPod(t *testing.T) {
|
||||
opts := []Option{WithPodSigners(tt.signers)}
|
||||
q := NewTestQueue(ctx, newDefaultQueueSort(), opts...)
|
||||
|
||||
signature := q.signPod(ctx, tt.pod)
|
||||
logger, _ := ktesting.NewTestContext(t)
|
||||
signature := q.signPod(ctx, logger, tt.pod)
|
||||
|
||||
if tt.expectedNil {
|
||||
if signature != nil {
|
||||
|
||||
Reference in New Issue
Block a user