diff --git a/plugin/cmd/scheduler/scheduler.go b/plugin/cmd/scheduler/scheduler.go index ca872ef0437..93850e59c96 100644 --- a/plugin/cmd/scheduler/scheduler.go +++ b/plugin/cmd/scheduler/scheduler.go @@ -58,7 +58,10 @@ func main() { go http.ListenAndServe(net.JoinHostPort(address.String(), strconv.Itoa(*port)), nil) configFactory := &factory.ConfigFactory{Client: kubeClient} - config := configFactory.Create() + config, err := configFactory.Create() + if err != nil { + glog.Fatalf("Can't create scheduler config: %v", err) + } s := scheduler.New(config) s.Run() diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index ae93baf1b9f..f512f37af76 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -42,7 +42,7 @@ type ConfigFactory struct { } // Create creates a scheduler and all support functions. -func (factory *ConfigFactory) Create() *scheduler.Config { +func (factory *ConfigFactory) Create() (*scheduler.Config, error) { // Watch and queue pods that need scheduling. podQueue := cache.NewFIFO() cache.NewReflector(factory.createUnassignedPodLW(), &api.Pod{}, podQueue).Run() @@ -66,8 +66,7 @@ func (factory *ConfigFactory) Create() *scheduler.Config { nodes, err := factory.Client.ListMinions() if err != nil { - glog.Errorf("failed to obtain minion information, aborting") - return nil + return nil, err } algo := algorithm.NewGenericScheduler( []algorithm.FitPredicate{ @@ -98,7 +97,7 @@ func (factory *ConfigFactory) Create() *scheduler.Config { return pod }, Error: factory.makeDefaultErrorFunc(&podBackoff, podQueue), - } + }, nil } type listWatch struct {