Expose NodeInfo to Score plugins

Co-authored-by: shenxin <rougang.hrg@alibaba-inc.com>
Signed-off-by: saintube <saintube@foxmail.com>
This commit is contained in:
saintube
2025-03-03 18:24:16 +08:00
committed by shenxin
parent 5d28e86245
commit afb4e96510
27 changed files with 138 additions and 105 deletions

View File

@@ -355,7 +355,7 @@ func (sp *ScorePlugin) Name() string {
}
// Score returns the score of scheduling a pod on a specific node.
func (sp *ScorePlugin) Score(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeName string) (int64, *framework.Status) {
func (sp *ScorePlugin) Score(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeInfo *framework.NodeInfo) (int64, *framework.Status) {
sp.mutex.Lock()
defer sp.mutex.Unlock()
@@ -367,7 +367,7 @@ func (sp *ScorePlugin) Score(ctx context.Context, state *framework.CycleState, p
score := int64(1)
if sp.numScoreCalled == 1 {
// The first node is scored the highest, the rest is scored lower.
sp.highScoreNode = nodeName
sp.highScoreNode = nodeInfo.Node().Name
score = framework.MaxNodeScore
}
return score, nil
@@ -383,7 +383,7 @@ func (sp *ScoreWithNormalizePlugin) Name() string {
}
// Score returns the score of scheduling a pod on a specific node.
func (sp *ScoreWithNormalizePlugin) Score(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeName string) (int64, *framework.Status) {
func (sp *ScoreWithNormalizePlugin) Score(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeInfo *framework.NodeInfo) (int64, *framework.Status) {
sp.mutex.Lock()
defer sp.mutex.Unlock()