Change the scheduler plugins PluginFactory function to use context parameter to pass logger

- Migrated pkg/scheduler/framework/plugins/nodevolumelimits to use contextual logging
- Fix golangci-lint validation failed
- Check for plugins creation err
This commit is contained in:
Mengjiao Liu
2023-09-06 11:55:33 +08:00
parent f9f00da6bc
commit a7466f44e0
53 changed files with 287 additions and 218 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package runtime
import (
"context"
"reflect"
"testing"
@@ -78,8 +79,8 @@ func TestDecodeInto(t *testing.T) {
func isRegistryEqual(registryX, registryY Registry) bool {
for name, pluginFactory := range registryY {
if val, ok := registryX[name]; ok {
p1, _ := pluginFactory(nil, nil)
p2, _ := val(nil, nil)
p1, _ := pluginFactory(nil, nil, nil)
p2, _ := val(nil, nil, nil)
if p1.Name() != p2.Name() {
// pluginFactory functions are not the same.
return false
@@ -110,7 +111,7 @@ func (p *mockNoopPlugin) Name() string {
func NewMockNoopPluginFactory() PluginFactory {
uuid := uuid.New().String()
return func(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
return func(_ context.Context, _ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
return &mockNoopPlugin{uuid}, nil
}
}