From 69523d8b96dbe9abaa6742c0feeedd6a97460b83 Mon Sep 17 00:00:00 2001 From: Andrzej Zukowski Date: Mon, 19 Feb 2024 06:55:35 -0500 Subject: [PATCH] [Issue-1084] Addjust scheduler extender algorithm Signed-off-by: Andrzej Zukowski --- pkg/scheduler/extender/extender.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pkg/scheduler/extender/extender.go b/pkg/scheduler/extender/extender.go index 11acf9cc6..1578340df 100644 --- a/pkg/scheduler/extender/extender.go +++ b/pkg/scheduler/extender/extender.go @@ -195,14 +195,21 @@ func (e *Extender) PrioritizeHandler(w http.ResponseWriter, req *http.Request) { e.Lock() defer e.Unlock() - hostPriority, err := e.score(extenderArgs.Nodes.Items) - if err != nil { - ll.Errorf("Unable to score %v", err) - return + pod := extenderArgs.Pod + var hostPriority []schedulerapi.HostPriority + requests, _ := e.gatherCapacityRequestsByProvisioner(context.TODO(), pod) + if len(requests) != 0 { + var err error + hostPriority, err = e.score(extenderArgs.Nodes.Items) + if err != nil { + ll.Errorf("Unable to score %v", err) + return + } + ll.Infof("Score results for pod %s: %v", pod, hostPriority) + } else { + ll.Infof("Skip skoring for pod: %s", pod) } - ll.Infof("Score results: %v", hostPriority) extenderRes := (schedulerapi.HostPriorityList)(hostPriority) - if err := resp.Encode(&extenderRes); err != nil { ll.Errorf("Unable to write response %v: %v", extenderRes, err) }