mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-01 02:38:12 +00:00 
			
		
		
		
	Fix panic when process RunScorePlugins for cap out of range
Signed-off-by: kerthcet <kerthcet@gmail.com>
This commit is contained in:
		| @@ -1015,7 +1015,7 @@ func (f *frameworkImpl) RunScorePlugins(ctx context.Context, state *framework.Cy | ||||
| 		metrics.FrameworkExtensionPointDuration.WithLabelValues(metrics.Score, status.Code().String(), f.profileName).Observe(metrics.SinceInSeconds(startTime)) | ||||
| 	}() | ||||
| 	allNodePluginScores := make([]framework.NodePluginScores, len(nodes)) | ||||
| 	numPlugins := len(f.scorePlugins) - state.SkipScorePlugins.Len() | ||||
| 	numPlugins := len(f.scorePlugins) | ||||
| 	plugins := make([]framework.ScorePlugin, 0, numPlugins) | ||||
| 	pluginToNodeScores := make(map[string]framework.NodeScoreList, numPlugins) | ||||
| 	for _, pl := range f.scorePlugins { | ||||
|   | ||||
| @@ -1385,6 +1385,22 @@ func TestRunScorePlugins(t *testing.T) { | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:           "skipped prescore plugin number greater than the number of score plugins", | ||||
| 			plugins:        buildScoreConfigDefaultWeights(scorePlugin1), | ||||
| 			pluginConfigs:  nil, | ||||
| 			skippedPlugins: sets.New(scorePlugin1, "score-plugin-unknown"), | ||||
| 			want: []framework.NodePluginScores{ | ||||
| 				{ | ||||
| 					Name:   "node1", | ||||
| 					Scores: []framework.PluginScore{}, | ||||
| 				}, | ||||
| 				{ | ||||
| 					Name:   "node2", | ||||
| 					Scores: []framework.PluginScore{}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	for _, tt := range tests { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 kerthcet
					kerthcet