Skip to content

Commit

Permalink
Fix: If the load balancing service does not have the annotation kube-…
Browse files Browse the repository at this point in the history
…vip.io/loadbalancerips, it will always be in a pending state

Signed-off-by: mars <pkevin0909@gmail.com>
  • Loading branch information
m198799 committed Dec 22, 2023
1 parent e11cc57 commit 4047a91
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/provider/loadBalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ func (k *kubevipLoadBalancerManager) syncLoadBalancer(ctx context.Context, servi

builder := &netipx.IPSetBuilder{}
for x := range svcs.Items {
addr, err := netip.ParseAddr(svcs.Items[x].Annotations[loadbalancerIPsAnnotations])
if err != nil {
return nil, err
if ip, ok := svcs.Items[x].Annotations[loadbalancerIPsAnnotations]; ok {
addr, err := netip.ParseAddr(ip)
if err != nil {
return nil, err
}
builder.Add(addr)
}
builder.Add(addr)
}
inUseSet, err := builder.IPSet()
if err != nil {
Expand Down

0 comments on commit 4047a91

Please sign in to comment.