mirror of https://github.com/k3s-io/k3s
Merge pull request #43226 from deads2k/controller-01-health
Automatic merge from submit-queue (batch tested with PRs 43144, 42671, 43226, 43314, 43361) don't start controllers against unhealthy master Operating against an unhealthy apiserver is unpredictable. Some clients like `kubectl` need to be best effort in this regard so that you can debug broken apiservers. Controllers shouldn't run against unhealthy masters.pull/6/head
commit
8ff822b764
|
@ -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
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue