Merge pull request #1613 from ghodss/fix_infinite_scheduler_crash

Prevent scheduler from crashing infinitely if apiserver is unreachable
This commit is contained in:
Brendan Burns
2014-10-07 12:46:42 -07:00
2 changed files with 7 additions and 5 deletions

View File

@@ -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 {