mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
Fix small comments.
This commit is contained in:
parent
429fa7a378
commit
2a5a121505
@ -400,8 +400,9 @@ func (gce *GCECloud) EnsureTCPLoadBalancer(name, region string, requestedIP net.
|
|||||||
return nil, fmt.Errorf("failed to delete existing forwarding rule %s for load balancer update: %v", name, err)
|
return nil, fmt.Errorf("failed to delete existing forwarding rule %s for load balancer update: %v", name, err)
|
||||||
}
|
}
|
||||||
if deleteFwdRuleIP {
|
if deleteFwdRuleIP {
|
||||||
// Delete the old IP to avoid leaking it, since we're going to be using
|
// Delete the old forwarding rule's IP to avoid leaking it, since we're
|
||||||
// the user-requested IP when recreating the forwarding rule below.
|
// going to be using the user-requested IP when recreating the forwarding
|
||||||
|
// rule below.
|
||||||
gce.deleteStaticIP(name, region)
|
gce.deleteStaticIP(name, region)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -429,6 +430,10 @@ func (gce *GCECloud) EnsureTCPLoadBalancer(name, region string, requestedIP net.
|
|||||||
return status, nil
|
return status, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Passing nil for requested IP is perfectly fine - it just means that no specific
|
||||||
|
// IP is being requested.
|
||||||
|
// Returns whether the forwarding rule exists, whether it needs to be updated,
|
||||||
|
// what its IP address is (if it exists), and any error we encountered.
|
||||||
func (gce *GCECloud) forwardingRuleNeedsUpdate(name, region string, requestedIP net.IP, ports []*api.ServicePort) (exists bool, needsUpdate bool, ipAddress string, err error) {
|
func (gce *GCECloud) forwardingRuleNeedsUpdate(name, region string, requestedIP net.IP, ports []*api.ServicePort) (exists bool, needsUpdate bool, ipAddress string, err error) {
|
||||||
fwd, err := gce.service.ForwardingRules.Get(gce.projectID, region, name).Do()
|
fwd, err := gce.service.ForwardingRules.Get(gce.projectID, region, name).Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -507,13 +512,10 @@ func (gce *GCECloud) firewallNeedsUpdate(name, region, ipAddress string, ports [
|
|||||||
if fw.Description != makeFirewallDescription(ipAddress) {
|
if fw.Description != makeFirewallDescription(ipAddress) {
|
||||||
return true, true, nil
|
return true, true, nil
|
||||||
}
|
}
|
||||||
// Make sure the allowed ports match
|
if len(fw.Allowed) != 1 || fw.Allowed[0].IPProtocol != "tcp" {
|
||||||
if len(fw.Allowed) != 1 {
|
|
||||||
return true, true, nil
|
|
||||||
}
|
|
||||||
if fw.Allowed[0].IPProtocol != "tcp" {
|
|
||||||
return true, true, nil
|
return true, true, nil
|
||||||
}
|
}
|
||||||
|
// Make sure the allowed ports match.
|
||||||
allowedPorts := make([]string, len(ports))
|
allowedPorts := make([]string, len(ports))
|
||||||
for ix := range ports {
|
for ix := range ports {
|
||||||
allowedPorts[ix] = strconv.Itoa(ports[ix].Port)
|
allowedPorts[ix] = strconv.Itoa(ports[ix].Port)
|
||||||
@ -624,7 +626,7 @@ func (gce *GCECloud) updateFirewall(name, region, ipAddress string, ports []*api
|
|||||||
}
|
}
|
||||||
if op != nil {
|
if op != nil {
|
||||||
err = gce.waitForGlobalOp(op)
|
err = gce.waitForGlobalOp(op)
|
||||||
if err != nil && !isHTTPErrorCode(err, http.StatusConflict) {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user