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

@@ -63,7 +63,7 @@ func (pl *DefaultPreemption) Name() string {
}
// New initializes a new plugin and returns it.
func New(dpArgs runtime.Object, fh framework.Handle, fts feature.Features) (framework.Plugin, error) {
func New(_ context.Context, dpArgs runtime.Object, fh framework.Handle, fts feature.Features) (framework.Plugin, error) {
args, ok := dpArgs.(*config.DefaultPreemptionArgs)
if !ok {
return nil, fmt.Errorf("got args of type %T, want *DefaultPreemptionArgs", dpArgs)

View File

@@ -104,7 +104,7 @@ type TestPlugin struct {
name string
}
func newTestPlugin(injArgs runtime.Object, f framework.Handle) (framework.Plugin, error) {
func newTestPlugin(_ context.Context, injArgs runtime.Object, f framework.Handle) (framework.Plugin, error) {
return &TestPlugin{name: "test-plugin"}, nil
}
@@ -1066,7 +1066,7 @@ func TestDryRunPreemption(t *testing.T) {
registeredPlugins := append([]tf.RegisterPluginFunc{
tf.RegisterFilterPlugin(
"FakeFilter",
func(_ runtime.Object, fh framework.Handle) (framework.Plugin, error) {
func(_ context.Context, _ runtime.Object, fh framework.Handle) (framework.Plugin, error) {
return &fakePlugin, nil
},
)},