kube-scheduler: NewFramework function to pass the context parameter

Co-authored-by: Aldo Culquicondor <1299064+alculquicondor@users.noreply.github.com>
This commit is contained in:
Mengjiao Liu
2023-05-15 18:36:17 +08:00
parent b31774d39b
commit 1c05cf1d51
31 changed files with 222 additions and 164 deletions

View File

@@ -17,6 +17,8 @@ limitations under the License.
package testing
import (
"context"
"k8s.io/apimachinery/pkg/runtime/schema"
kubeschedulerconfigv1 "k8s.io/kube-scheduler/config/v1"
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
@@ -28,7 +30,7 @@ import (
var configDecoder = scheme.Codecs.UniversalDecoder()
// NewFramework creates a Framework from the register functions and options.
func NewFramework(fns []RegisterPluginFunc, profileName string, stopCh <-chan struct{}, opts ...runtime.Option) (framework.Framework, error) {
func NewFramework(ctx context.Context, fns []RegisterPluginFunc, profileName string, opts ...runtime.Option) (framework.Framework, error) {
registry := runtime.Registry{}
profile := &schedulerapi.KubeSchedulerProfile{
SchedulerName: profileName,
@@ -37,7 +39,7 @@ func NewFramework(fns []RegisterPluginFunc, profileName string, stopCh <-chan st
for _, f := range fns {
f(&registry, profile)
}
return runtime.NewFramework(registry, profile, stopCh, opts...)
return runtime.NewFramework(ctx, registry, profile, opts...)
}
// RegisterPluginFunc is a function signature used in method RegisterFilterPlugin()