Add compatibility tests for plugin config

This commit is contained in:
skilxn-go
2020-03-22 18:17:52 +08:00
parent d23310a40e
commit e0adb0ead9
4 changed files with 175 additions and 52 deletions

View File

@@ -134,6 +134,7 @@ type schedulerOptions struct {
frameworkOutOfTreeRegistry framework.Registry
profiles []schedulerapi.KubeSchedulerProfile
extenders []schedulerapi.Extender
frameworkCapturer FrameworkCapturer
}
// Option configures a Scheduler
@@ -204,6 +205,16 @@ func WithExtenders(e ...schedulerapi.Extender) Option {
}
}
// FrameworkCapturer is used for registering a notify function in building framework.
type FrameworkCapturer func(schedulerapi.KubeSchedulerProfile)
// WithBuildFrameworkCapturer sets a notify function for getting buildFramework details.
func WithBuildFrameworkCapturer(fc FrameworkCapturer) Option {
return func(o *schedulerOptions) {
o.frameworkCapturer = fc
}
}
var defaultSchedulerOptions = schedulerOptions{
profiles: []schedulerapi.KubeSchedulerProfile{
// Profiles' default plugins are set from the algorithm provider.
@@ -273,6 +284,7 @@ func New(client clientset.Interface,
registry: registry,
nodeInfoSnapshot: snapshot,
extenders: options.extenders,
frameworkCapturer: options.frameworkCapturer,
}
metrics.Register()