@@ -450,7 +450,7 @@ func (p *PriorityQueue) isPodWorthRequeuing(logger klog.Logger, pInfo *framework
450
450
}
451
451
hint = framework .Queue
452
452
}
453
- p .metricsRecorder .ObserveQueueingHintDurationAsync (hintfn .PluginName , event .Label , queueingHintToLabel (hint , err ), metrics .SinceInSeconds (start ))
453
+ p .metricsRecorder .ObserveQueueingHintDurationAsync (hintfn .PluginName , event .Label () , queueingHintToLabel (hint , err ), metrics .SinceInSeconds (start ))
454
454
455
455
if hint == framework .QueueSkip {
456
456
continue
@@ -571,7 +571,7 @@ func (p *PriorityQueue) moveToActiveQ(logger klog.Logger, pInfo *framework.Queue
571
571
_ = p .podBackoffQ .Delete (pInfo ) // Don't need to react when pInfo is not found.
572
572
logger .V (5 ).Info ("Pod moved to an internal scheduling queue" , "pod" , klog .KObj (pInfo .Pod ), "event" , event , "queue" , activeQ )
573
573
metrics .SchedulerQueueIncomingPods .WithLabelValues ("active" , event ).Inc ()
574
- if event == framework .PodAdd || event == framework .PodUpdate {
574
+ if event == framework .EventUnscheduledPodAdd . Label () || event == framework .EventUnscheduledPodUpdate . Label () {
575
575
p .AddNominatedPod (logger , pInfo .PodInfo , nil )
576
576
}
577
577
})
@@ -585,7 +585,7 @@ func (p *PriorityQueue) Add(logger klog.Logger, pod *v1.Pod) {
585
585
defer p .lock .Unlock ()
586
586
587
587
pInfo := p .newQueuedPodInfo (pod )
588
- if added := p .moveToActiveQ (logger , pInfo , framework .PodAdd ); added {
588
+ if added := p .moveToActiveQ (logger , pInfo , framework .EventUnscheduledPodAdd . Label () ); added {
589
589
p .activeQ .broadcast ()
590
590
}
591
591
}
@@ -660,7 +660,7 @@ func (p *PriorityQueue) determineSchedulingHintForInFlightPod(logger klog.Logger
660
660
// check if there is an event that makes this Pod schedulable based on pInfo.UnschedulablePlugins.
661
661
queueingStrategy := queueSkip
662
662
for _ , e := range events {
663
- logger .V (5 ).Info ("Checking event for in-flight pod" , "pod" , klog .KObj (pInfo .Pod ), "event" , e .event .Label )
663
+ logger .V (5 ).Info ("Checking event for in-flight pod" , "pod" , klog .KObj (pInfo .Pod ), "event" , e .event .Label () )
664
664
665
665
switch p .isPodWorthRequeuing (logger , pInfo , e .event , e .oldObj , e .newObj ) {
666
666
case queueSkip :
@@ -818,7 +818,7 @@ func (p *PriorityQueue) flushUnschedulablePodsLeftover(logger klog.Logger) {
818
818
}
819
819
820
820
if len (podsToMove ) > 0 {
821
- p .movePodsToActiveOrBackoffQueue (logger , podsToMove , framework .UnschedulableTimeout , nil , nil )
821
+ p .movePodsToActiveOrBackoffQueue (logger , podsToMove , framework .EventUnschedulableTimeout , nil , nil )
822
822
}
823
823
}
824
824
@@ -878,13 +878,15 @@ func (p *PriorityQueue) Update(logger klog.Logger, oldPod, newPod *v1.Pod) {
878
878
p .lock .Lock ()
879
879
defer p .lock .Unlock ()
880
880
881
+ var events []framework.ClusterEvent
881
882
if p .isSchedulingQueueHintEnabled {
883
+ events = framework .PodSchedulingPropertiesChange (newPod , oldPod )
882
884
// The inflight pod will be requeued using the latest version from the informer cache, which matches what the event delivers.
883
- // Record this update as Pod/Update because
885
+ // Record this Pod update because
884
886
// this update may make the Pod schedulable in case it gets rejected and comes back to the queue.
885
887
// We can clean it up once we change updatePodInSchedulingQueue to call MoveAllToActiveOrBackoffQueue.
886
888
// See https://github.com/kubernetes/kubernetes/pull/125578#discussion_r1648338033 for more context.
887
- if exists := p .activeQ .addEventIfPodInFlight (oldPod , newPod , framework . UnscheduledPodUpdate ); exists {
889
+ if exists := p .activeQ .addEventsIfPodInFlight (oldPod , newPod , events ); exists {
888
890
logger .V (6 ).Info ("The pod doesn't be queued for now because it's being scheduled and will be queued back if necessary" , "pod" , klog .KObj (newPod ))
889
891
return
890
892
}
@@ -917,12 +919,11 @@ func (p *PriorityQueue) Update(logger klog.Logger, oldPod, newPod *v1.Pod) {
917
919
// whether the update may make the pods schedulable.
918
920
// Plugins have to implement a QueueingHint for Pod/Update event
919
921
// if the rejection from them could be resolved by updating unscheduled Pods itself.
920
- events := framework .PodSchedulingPropertiesChange (newPod , oldPod )
921
922
for _ , evt := range events {
922
923
hint := p .isPodWorthRequeuing (logger , pInfo , evt , oldPod , newPod )
923
- queue := p .requeuePodViaQueueingHint (logger , pInfo , hint , evt .Label )
924
+ queue := p .requeuePodViaQueueingHint (logger , pInfo , hint , evt .Label () )
924
925
if queue != unschedulablePods {
925
- logger .V (5 ).Info ("Pod moved to an internal scheduling queue because the Pod is updated" , "pod" , klog .KObj (newPod ), "event" , evt .Label , "queue" , queue )
926
+ logger .V (5 ).Info ("Pod moved to an internal scheduling queue because the Pod is updated" , "pod" , klog .KObj (newPod ), "event" , evt .Label () , "queue" , queue )
926
927
p .unschedulablePods .delete (pInfo .Pod , gated )
927
928
}
928
929
if queue == activeQ {
@@ -936,7 +937,7 @@ func (p *PriorityQueue) Update(logger klog.Logger, oldPod, newPod *v1.Pod) {
936
937
if p .isPodBackingoff (pInfo ) {
937
938
p .podBackoffQ .AddOrUpdate (pInfo )
938
939
p .unschedulablePods .delete (pInfo .Pod , gated )
939
- logger .V (5 ).Info ("Pod moved to an internal scheduling queue" , "pod" , klog .KObj (pInfo .Pod ), "event" , framework .PodUpdate , "queue" , backoffQ )
940
+ logger .V (5 ).Info ("Pod moved to an internal scheduling queue" , "pod" , klog .KObj (pInfo .Pod ), "event" , framework .EventUnscheduledPodUpdate . Label () , "queue" , backoffQ )
940
941
return
941
942
}
942
943
@@ -952,7 +953,7 @@ func (p *PriorityQueue) Update(logger klog.Logger, oldPod, newPod *v1.Pod) {
952
953
}
953
954
// If pod is not in any of the queues, we put it in the active queue.
954
955
pInfo := p .newQueuedPodInfo (newPod )
955
- if added := p .moveToActiveQ (logger , pInfo , framework .PodUpdate ); added {
956
+ if added := p .moveToActiveQ (logger , pInfo , framework .EventUnscheduledPodUpdate . Label () ); added {
956
957
p .activeQ .broadcast ()
957
958
}
958
959
}
@@ -980,7 +981,7 @@ func (p *PriorityQueue) AssignedPodAdded(logger klog.Logger, pod *v1.Pod) {
980
981
981
982
// Pre-filter Pods to move by getUnschedulablePodsWithCrossTopologyTerm
982
983
// because Pod related events shouldn't make Pods that rejected by single-node scheduling requirement schedulable.
983
- p .movePodsToActiveOrBackoffQueue (logger , p .getUnschedulablePodsWithCrossTopologyTerm (logger , pod ), framework .AssignedPodAdd , nil , pod )
984
+ p .movePodsToActiveOrBackoffQueue (logger , p .getUnschedulablePodsWithCrossTopologyTerm (logger , pod ), framework .EventAssignedPodAdd , nil , pod )
984
985
p .lock .Unlock ()
985
986
}
986
987
@@ -991,7 +992,7 @@ func (p *PriorityQueue) AssignedPodUpdated(logger klog.Logger, oldPod, newPod *v
991
992
if event .Resource == framework .Pod && event .ActionType & framework .UpdatePodScaleDown != 0 {
992
993
// In this case, we don't want to pre-filter Pods by getUnschedulablePodsWithCrossTopologyTerm
993
994
// because Pod related events may make Pods that were rejected by NodeResourceFit schedulable.
994
- p .moveAllToActiveOrBackoffQueue (logger , framework .AssignedPodUpdate , oldPod , newPod , nil )
995
+ p .moveAllToActiveOrBackoffQueue (logger , framework .EventAssignedPodUpdate , oldPod , newPod , nil )
995
996
} else {
996
997
// Pre-filter Pods to move by getUnschedulablePodsWithCrossTopologyTerm
997
998
// because Pod related events only make Pods rejected by cross topology term schedulable.
@@ -1093,13 +1094,13 @@ func (p *PriorityQueue) movePodsToActiveOrBackoffQueue(logger klog.Logger, podIn
1093
1094
schedulingHint := p .isPodWorthRequeuing (logger , pInfo , event , oldObj , newObj )
1094
1095
if schedulingHint == queueSkip {
1095
1096
// QueueingHintFn determined that this Pod isn't worth putting to activeQ or backoffQ by this event.
1096
- logger .V (5 ).Info ("Event is not making pod schedulable" , "pod" , klog .KObj (pInfo .Pod ), "event" , event .Label )
1097
+ logger .V (5 ).Info ("Event is not making pod schedulable" , "pod" , klog .KObj (pInfo .Pod ), "event" , event .Label () )
1097
1098
continue
1098
1099
}
1099
1100
1100
1101
p .unschedulablePods .delete (pInfo .Pod , pInfo .Gated )
1101
- queue := p .requeuePodViaQueueingHint (logger , pInfo , schedulingHint , event .Label )
1102
- logger .V (4 ).Info ("Pod moved to an internal scheduling queue" , "pod" , klog .KObj (pInfo .Pod ), "event" , event .Label , "queue" , queue , "hint" , schedulingHint )
1102
+ queue := p .requeuePodViaQueueingHint (logger , pInfo , schedulingHint , event .Label () )
1103
+ logger .V (4 ).Info ("Pod moved to an internal scheduling queue" , "pod" , klog .KObj (pInfo .Pod ), "event" , event .Label () , "queue" , queue , "hint" , schedulingHint )
1103
1104
if queue == activeQ {
1104
1105
activated = true
1105
1106
}
@@ -1112,7 +1113,7 @@ func (p *PriorityQueue) movePodsToActiveOrBackoffQueue(logger klog.Logger, podIn
1112
1113
// AddUnschedulableIfNotPresent we need to know whether events were
1113
1114
// observed while scheduling them.
1114
1115
if added := p .activeQ .addEventIfAnyInFlight (oldObj , newObj , event ); added {
1115
- logger .V (5 ).Info ("Event received while pods are in flight" , "event" , event .Label )
1116
+ logger .V (5 ).Info ("Event received while pods are in flight" , "event" , event .Label () )
1116
1117
}
1117
1118
}
1118
1119
0 commit comments