Merge pull request #52646 from gmarek/cm-panic

Automatic merge from submit-queue (batch tested with PRs 51337, 47080, 52646, 52635, 52666). 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>..

Fix panic in ControllerManager when GCE external loadbalancer healthcheck is nil

Fix #52722

We should cherry pick it to 1.7 and 1.6.

cc @nicksardo @abgworrall @wojtek-t @ethernetdan @enisoc 

```release-note
Fix panic in ControllerManager on GCE when it has a problem with creating external loadbalancer healthcheck
```
This commit is contained in:
Kubernetes Submit Queue 2017-09-19 17:31:09 -07:00 committed by GitHub
commit 177df68362

View File

@ -514,8 +514,9 @@ func (gce *GCECloud) createTargetPool(svc *v1.Service, name, serviceName, ipAddr
return err
}
var err error
hcRequestPath, hcPort := hc.RequestPath, hc.Port
if hc, err = gce.ensureHttpHealthCheck(hc.Name, hc.RequestPath, int32(hc.Port)); err != nil || hc == nil {
return fmt.Errorf("Failed to ensure health check for %v port %d path %v: %v", name, hc.Port, hc.RequestPath, err)
return fmt.Errorf("Failed to ensure health check for %v port %d path %v: %v", name, hcPort, hcRequestPath, err)
}
hcLinks = append(hcLinks, hc.SelfLink)
}