mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Add support for writing out of tree custom scheduler plugins
This commit is contained in:
parent
8c3b7d7679
commit
ea8e1e01c5
@ -58,6 +58,8 @@ import (
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
var frameworkRegistry = framework.NewRegistry()
|
||||
|
||||
// NewSchedulerCommand creates a *cobra.Command object with default parameters
|
||||
func NewSchedulerCommand() *cobra.Command {
|
||||
opts, err := options.NewOptions()
|
||||
@ -175,7 +177,7 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
|
||||
cc.Recorder,
|
||||
cc.ComponentConfig.AlgorithmSource,
|
||||
stopCh,
|
||||
framework.NewRegistry(),
|
||||
frameworkRegistry,
|
||||
cc.ComponentConfig.Plugins,
|
||||
cc.ComponentConfig.PluginConfig,
|
||||
scheduler.WithName(cc.ComponentConfig.SchedulerName),
|
||||
@ -326,3 +328,9 @@ func newHealthzHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration, s
|
||||
}
|
||||
return pathRecorderMux
|
||||
}
|
||||
|
||||
// RegisterFrameworkPlugin adds a new plugin to the registry. If a plugin with the same name
|
||||
// exists, it returns an error.
|
||||
func RegisterFrameworkPlugin(name string, factory framework.PluginFactory) error {
|
||||
return frameworkRegistry.Register(name, factory)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user