Skip to content

Commit

Permalink
loadbalancer: Simplify several parts
Browse files Browse the repository at this point in the history
  • Loading branch information
nachtjasmin committed Oct 22, 2024
1 parent d9dc70f commit 6fcb845
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions anx/provider/loadbalancer/address/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (m *mgr) AllocateAddresses(ctx context.Context, svc *v1.Service) ([]string,
if !ok {
m.logger.V(1).Info("No addresses for IP family allocated yet", "family", fam)

addr, err := m.allocateAddress(ctx, svc, fam)
addr, err := m.allocateAddress(ctx, fam)
if err != nil {
return nil, fmt.Errorf("error allocating address for family %q: %w", fam, err)
}
Expand All @@ -146,7 +146,7 @@ func (m *mgr) prefixes(ctx context.Context) ([]*prefix, error) {

ret := make([]*prefix, 0)

if m.fixedPrefixes != nil && len(m.fixedPrefixes) > 0 {
if len(m.fixedPrefixes) > 0 {
ret = append(ret, m.fixedPrefixes...)
}

Expand Down Expand Up @@ -185,7 +185,7 @@ func (m *mgr) prefixes(ctx context.Context) ([]*prefix, error) {
return ret, nil
}

func (m *mgr) allocateAddress(ctx context.Context, svc *v1.Service, fam v1.IPFamily) (net.IP, error) {
func (m *mgr) allocateAddress(ctx context.Context, fam v1.IPFamily) (net.IP, error) {
log := logr.FromContextOrDiscard(ctx)

prefixes, err := m.prefixes(ctx)
Expand Down Expand Up @@ -244,7 +244,7 @@ func serviceAddressFamilies(svc *v1.Service) ([]v1.IPFamily, error) {
func serviceAddresses(svc *v1.Service) []string {
status := svc.Status.LoadBalancer

if status.Ingress == nil || len(status.Ingress) == 0 {
if len(status.Ingress) == 0 {
return []string{}
}

Expand Down
2 changes: 1 addition & 1 deletion anx/provider/loadbalancer/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (m *mgr) configureLoadBalancers(ctx context.Context, config *configuration.
m.loadBalancers = []string{config.LoadBalancerIdentifier}
}

if m.loadBalancers == nil || len(m.loadBalancers) == 0 {
if len(m.loadBalancers) == 0 {
return ErrNoLoadBalancers
}

Expand Down

0 comments on commit 6fcb845

Please sign in to comment.