fix(scheduler): fix incorrect loop logic in MultiPoint to avoid a plugin being loaded multiple times

Signed-off-by: caohe <caohe9603@gmail.com>
This commit is contained in:
caohe
2023-11-29 14:07:27 +08:00
parent ad9b60e2c9
commit 1f5738df84
2 changed files with 51 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ import (
"k8s.io/kubernetes/pkg/scheduler/framework"
"k8s.io/kubernetes/pkg/scheduler/framework/parallelize"
"k8s.io/kubernetes/pkg/scheduler/metrics"
"k8s.io/kubernetes/pkg/util/slice"
)
const (
@@ -526,7 +527,7 @@ func (f *frameworkImpl) expandMultiPointPlugins(logger klog.Logger, profile *con
// - part 3: other plugins (excluded by part 1 & 2) in regular extension point.
newPlugins := reflect.New(reflect.TypeOf(e.slicePtr).Elem()).Elem()
// part 1
for _, name := range enabledSet.list {
for _, name := range slice.CopyStrings(enabledSet.list) {
if overridePlugins.has(name) {
newPlugins = reflect.Append(newPlugins, reflect.ValueOf(pluginsMap[name]))
enabledSet.delete(name)