don't start controllers against unhealthy master

pull/6/head
deads2k 2017-03-16 11:05:03 -04:00
parent b617cabfca
commit 0a2cd24f9d
1 changed files with 7 additions and 0 deletions

View File

@ -331,6 +331,13 @@ func getAvailableResources(clientBuilder controller.ControllerClientBuilder) (ma
return false, nil
}
healthStatus := 0
client.Discovery().RESTClient().Get().AbsPath("/healthz").Do().StatusCode(&healthStatus)
if healthStatus != http.StatusOK {
glog.Errorf("Server isn't healthy yet. Waiting a little while.")
return false, nil
}
discoveryClient = client.Discovery()
return true, nil
})