GoogleCloudPlatform/kubernetes — pull request #1613 by ghodss (2014-10-07 02:30:46+00:00)
Title: Prevent scheduler from crashing infinitely if apiserver is unreachable

Currently the `scheduler` binary will enter an infinite nil pointer reference loop if `apiserver` is not ready to accept requests when `scheduler` starts up. (This happens in hack/local-up-cluster.sh, which will be fixed in a separate PR.) This PR fixes it to just abort immediately.

Better would be another PR which cleans this up to do some retries... the minion information should likely be injected into the CreateConfig() function. For now this has been coded up just to prevent my disk from filling up with log messages every time I run hack/local-up-cluster.sh.

FTR one should never return nil for a reference without a corresponding error param. `if err != nil` is the only way that nil pointer references are conventionally avoided in Go.