Change:
<!-- Please only use this template for submitting enhancement requests --What would you like to be : As the is now implementable, it will be easier to add out of tree scheduler. And we are trying to use it to implement our plugins. The issue tracks following problems: Implement interface same as Custom Scheduler Plugins (out of tree)  to support out of tree scheduler Add support for scheduler to load and register user’s out of tree scheduling plugins that could be configured by admins. We could use to implement it, however it has some drawbacks as pointed out, e.g. We need find other ways, e.g. . /sig scheduling /assign
I did some investigation. It seems that is a better choice for the second part of this issue. I am making a prototype for it. Need I send a proposal at first? /cc
Just wrote a small proposal for it

Discussion:
"k8s.io/klog" ) <del> // NewSchedulerCommand creates a *cobra.Command object with default parameters func NewSchedulerCommand() *cobra.Command { </del> <ins> // Option configures a framework.Registry. type Option func(framework.Registry) error // NewSchedulerCommand creates a *cobra.Command object with default parameters and registryOptions func NewSchedulerCommand(registryOptions ...Option) *cobra.Command { </ins> opts, err := options.NewOptions() if err != nil { klog.Fatalf("unable to initialize command options: %v", err)

interference, deadlines, and so on. Workload-specific requirements will be exposed through the API as necessary.`, Run: func(cmd *cobra.Command, args []string) { <del> if err := runCommand(cmd, args, opts); err != nil { </del> <ins> if err := runCommand(cmd, args, opts, registryOptions...); err != nil { </ins> fmt.Fprintf(os.Stderr, "%vn", err) os.Exit(1) }

} // runCommand runs the scheduler. <del> func runCommand(cmd *cobra.Command, args []string, opts *options.Options) error { </del> <ins> func runCommand(cmd *cobra.Command, args []string, opts *options.Options, registryOptions ...Option) error { </ins> verflag.PrintAndExitIfRequested() utilflag.PrintFlags(cmd.Flags())

} stopCh := make(chan struct{}) // Get the completed config cc := c.Complete()

return fmt.Errorf("unable to register configz: %s", err) } <del> return Run(cc, stopCh) </del> <ins> return Run(cc, stopCh, registryOptions...) </ins> } // Run executes the scheduler based on the given configuration. It only return on error or when stopCh is closed. <del> func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error { </del> <ins> func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}, registryOptions ...Option) error { </ins> // To help debugging, immediately log version klog.V(1).Infof("Starting Kubernetes Scheduler version %+v", version.Get()) <ins> registry := framework.NewRegistry() for _, option := range registryOptions { if err := option(registry); err != nil { return err } } </ins> // Create the scheduler. sched, err := scheduler.New(cc.Client, cc.InformerFactory.Core().V1().Nodes(),

cc.Recorder, cc.ComponentConfig.AlgorithmSource, stopCh, <del> framework.NewRegistry(), </del> <ins> registry, </ins> cc.ComponentConfig.Plugins, cc.ComponentConfig.PluginConfig, scheduler.WithName(cc.ComponentConfig.SchedulerName),

} return pathRecorderMux } <ins> // WithPlugin creates an Option based on plugin name and factory. func WithPlugin(name string, factory framework.PluginFactory) Option { return func(registry framework.Registry) error { return registry.Register(name, factory) } } </ins>