Fix panic in ControllerManager when GCE external loadbalancer healthcheck is nil

This commit is contained in:
Marek Grabowski 2017-09-18 10:45:06 +01:00
parent 9aef242a4c
commit e3e9de6010

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)
}