Skip to content

Commit ea8e1e0

Browse files
committed
Add support for writing out of tree custom scheduler plugins
1 parent 8c3b7d7 commit ea8e1e0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/kube-scheduler/app/server.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ import (
5858
"k8s.io/klog"
5959
)
6060

61+
var frameworkRegistry = framework.NewRegistry()
62+
6163
// NewSchedulerCommand creates a *cobra.Command object with default parameters
6264
func NewSchedulerCommand() *cobra.Command {
6365
opts, err := options.NewOptions()
@@ -175,7 +177,7 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
175177
cc.Recorder,
176178
cc.ComponentConfig.AlgorithmSource,
177179
stopCh,
178-
framework.NewRegistry(),
180+
frameworkRegistry,
179181
cc.ComponentConfig.Plugins,
180182
cc.ComponentConfig.PluginConfig,
181183
scheduler.WithName(cc.ComponentConfig.SchedulerName),
@@ -326,3 +328,9 @@ func newHealthzHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration, s
326328
}
327329
return pathRecorderMux
328330
}
331+
332+
// RegisterFrameworkPlugin adds a new plugin to the registry. If a plugin with the same name
333+
// exists, it returns an error.
334+
func RegisterFrameworkPlugin(name string, factory framework.PluginFactory) error {
335+
return frameworkRegistry.Register(name, factory)
336+
}

0 commit comments

Comments
 (0)