mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 15:13:08 +00:00
Merge pull request #7669 from a-robinson/lb
Change the cloud provider TCPLoadBalancerExists function to GetTCPLoadBalancer...
This commit is contained in:
@@ -239,16 +239,16 @@ func (gce *GCECloud) waitForRegionOp(op *compute.Operation, region string) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// TCPLoadBalancerExists is an implementation of TCPLoadBalancer.TCPLoadBalancerExists.
|
||||
func (gce *GCECloud) TCPLoadBalancerExists(name, region string) (bool, error) {
|
||||
_, err := gce.service.ForwardingRules.Get(gce.projectID, region, name).Do()
|
||||
// GetTCPLoadBalancer is an implementation of TCPLoadBalancer.GetTCPLoadBalancer
|
||||
func (gce *GCECloud) GetTCPLoadBalancer(name, region string) (endpoint string, exists bool, err error) {
|
||||
fw, err := gce.service.ForwardingRules.Get(gce.projectID, region, name).Do()
|
||||
if err == nil {
|
||||
return true, nil
|
||||
return fw.IPAddress, true, nil
|
||||
}
|
||||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
||||
return false, nil
|
||||
return "", false, nil
|
||||
}
|
||||
return false, err
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
func isHTTPErrorCode(err error, code int) bool {
|
||||
|
Reference in New Issue
Block a user