in pkg/plugin/scheduler_plugin.go [270:306]
func NewSchedulerPlugin(_ context.Context, _ runtime.Object, handle framework.Handle) (framework.Plugin, error) {
log.Log(log.ShimSchedulerPlugin).Info(conf.GetBuildInfoString())
log.Log(log.ShimSchedulerPlugin).Warn("The plugin mode has been deprecated and will be removed in a future release. Consider migrating to YuniKorn standalone mode.")
configMaps, err := client.LoadBootstrapConfigMaps()
if err != nil {
log.Log(log.ShimSchedulerPlugin).Fatal("Unable to bootstrap configuration", zap.Error(err))
}
err = conf.UpdateConfigMaps(configMaps, true)
if err != nil {
log.Log(log.ShimSchedulerPlugin).Fatal("Unable to load initial configmaps", zap.Error(err))
}
// start the YK core scheduler
serviceContext := entrypoint.StartAllServicesWithLogger(log.RootLogger(), log.GetZapConfigs())
if serviceContext.RMProxy == nil {
return nil, fmt.Errorf("internal error: serviceContext should implement interface api.SchedulerAPI")
}
// we need our own informer factory here because the informers we get from the framework handle aren't yet initialized
informerFactory := informers.NewSharedInformerFactory(handle.ClientSet(), 0)
ss := shim.NewShimSchedulerForPlugin(serviceContext.RMProxy, informerFactory, conf.GetSchedulerConf(), configMaps)
if err := ss.Run(); err != nil {
log.Log(log.ShimSchedulerPlugin).Fatal("Unable to start scheduler", zap.Error(err))
}
context := ss.GetContext()
context.SetPodActivator(func(logger klog.Logger, pod *v1.Pod) {
handle.Activate(logger, map[string]*v1.Pod{pod.Name: pod})
})
p := &YuniKornSchedulerPlugin{
context: context,
}
events.SetRecorder(handle.EventRecorder())
return p, nil
}