Skip to content

Commit c9c9e66

Browse files
authored
Merge pull request #195 from k8s-proxmox/fix/node-score-plugin
fix empty node score list error
2 parents a98cc8d + 067b01c commit c9c9e66

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cloud/scheduler/plugins/noderesource/node_resrouce.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ func (pl *NodeResource) Score(ctx context.Context, state *framework.CycleState,
2929
u := cpu / float32(maxCPU) * float32(mem/maxMem)
3030
score := int64(1 / u)
3131
status := framework.NewStatus()
32-
status.SetCode(1)
32+
status.SetCode(0)
3333
return score, status
3434
}

cloud/scheduler/scheduler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,21 @@ func (s *Scheduler) RunScorePlugins(ctx context.Context, state *framework.CycleS
379379
s.logger.Info("scoring proxmox node")
380380
status := framework.NewStatus()
381381
scoresMap := make(map[string](map[int]framework.NodeScore))
382+
for _, pl := range s.registry.ScorePlugins() {
383+
scoresMap[pl.Name()] = make(map[int]framework.NodeScore)
384+
}
382385
nodeInfos, err := framework.GetNodeInfoList(ctx, s.client)
383386
if err != nil {
384387
status.SetCode(1)
388+
s.logger.Error(err, "failed to get node info list")
385389
return nil, status
386390
}
387391
for index, nodeInfo := range nodeInfos {
388392
for _, pl := range s.registry.ScorePlugins() {
389393
score, status := pl.Score(ctx, state, config, nodeInfo)
390394
if !status.IsSuccess() {
395+
status.SetCode(1)
396+
s.logger.Error(status.Error(), fmt.Sprintf("failed to score node %s", nodeInfo.Node().Node))
391397
return nil, status
392398
}
393399
scoresMap[pl.Name()][index] = framework.NodeScore{

0 commit comments

Comments
 (0)