Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tchinmai7 committed Jan 29, 2024
1 parent 253b4f1 commit 8476f12
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cloud/linode/loadbalancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri
return lbStatus, nil
}

// getNodeBalancerDeviceId gets the deviceID of the nodeBalancer that is attached to the firewall.
func (l *loadbalancers) getNodeBalancerDeviceId(ctx context.Context, firewallID, nbID int) (int, bool, error) {
// getNodeBalancerDeviceID gets the deviceID of the nodeBalancer that is attached to the firewall.
func (l *loadbalancers) getNodeBalancerDeviceID(ctx context.Context, firewallID, nbID int) (int, bool, error) {
devices, err := l.client.ListFirewallDevices(ctx, firewallID, &linodego.ListOptions{})
if err != nil {
return 0, false, err
Expand Down Expand Up @@ -271,6 +271,7 @@ func (l *loadbalancers) updateFirewallwithID(ctx context.Context, service *v1.Se
return err
}
if len(firewalls) > 1 {
klog.Errorf("Found more than one firewall attached to nodebalancer: %d, firewall IDs: %v", nb.ID, firewalls)
return errTooManyFirewalls
}

Expand All @@ -292,7 +293,7 @@ func (l *loadbalancers) updateFirewallwithID(ctx context.Context, service *v1.Se
}
// remove the existing firewall if it exists
if existingFirewallID != 0 {
deviceID, deviceExists, err := l.getNodeBalancerDeviceId(ctx, existingFirewallID, nb.ID)
deviceID, deviceExists, err := l.getNodeBalancerDeviceID(ctx, existingFirewallID, nb.ID)
if err != nil {
return err
}
Expand Down Expand Up @@ -430,6 +431,7 @@ func (l *loadbalancers) updateFWwithACL(ctx context.Context, service *v1.Service
}
}
default:
klog.Errorf("Found more than one firewall attached to nodebalancer: %d, firewall IDs: %v", nb.ID, firewalls)
return errTooManyFirewalls
}
return nil
Expand Down Expand Up @@ -474,6 +476,7 @@ func (l *loadbalancers) updateNodeBalancerFirewall(ctx context.Context, service
return nil
}
if len(firewalls) > 1 {
klog.Errorf("Found more than one firewall attached to nodebalancer: %d, firewall IDs: %v", nb.ID, firewalls)
return errTooManyFirewalls
}

Expand Down

0 comments on commit 8476f12

Please sign in to comment.