Merge pull request #60585 from alexbrand/kubeadm-external-etcd-preflight

Automatic merge from submit-queue (batch tested with PRs 60585, 62398, 62258, 62042). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubeadm: surface external etcd preflight validation errors

**What this PR does / why we need it**: 
This PR fixes a bug where errors that could occur while running preflight against an external etcd cluster were not being surfaced to the user.

**Which issue(s) this PR fixes** :
Fixes https://github.com/kubernetes/kubeadm/issues/719

**Release note**:

```release-note
kubeadm: surface external etcd preflight validation errors
```
pull/8/head
Kubernetes Submit Queue 2018-04-11 17:31:19 -07:00 committed by GitHub
commit 8d1a4cae79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -848,13 +848,13 @@ func getEtcdVersionResponse(client *http.Client, url string, target interface{})
r, err := client.Get(url) r, err := client.Get(url)
if err != nil { if err != nil {
loopCount-- loopCount--
return false, nil return false, err
} }
defer r.Body.Close() defer r.Body.Close()
if r != nil && r.StatusCode >= 500 && r.StatusCode <= 599 { if r != nil && r.StatusCode >= 500 && r.StatusCode <= 599 {
loopCount-- loopCount--
return false, nil return false, fmt.Errorf("server responded with non-successful status: %s", r.Status)
} }
return true, json.NewDecoder(r.Body).Decode(target) return true, json.NewDecoder(r.Body).Decode(target)