Fix layer2 not arping when IP changes
SetBalancer in Announcer.go essentially short circuits if the load balancer is already set.
The fix just deletes the existing balancer for the service and allows it to fall through and create a new one with the new IP.
@@ -31,7 +31,7 @@ import (
"go.universe.tf/metallb/internal/layer2"
"go.universe.tf/metallb/internal/logging"
"go.universe.tf/metallb/internal/version"
- "k8s.io/api/core/v1"
+ v1 "k8s.io/api/core/v1"
gokitlog "github.com/go-kit/kit/log"
"github.com/hashicorp/memberlist"
@@ -307,6 +307,12 @@ func (c *controller) SetBalancer(l gokitlog.Logger, name string, svc *v1.Service
}
}
+ if svcIP, ok := c.svcIP[name]; ok && !lbIP.Equal(svcIP) {
+ if st := c.deleteBalancer(l, name, "loadBalancerIPChanged"); st == k8s.SyncStateError {
+ return st
+ }
+ }
+
l = gokitlog.With(l, "protocol", pool.Protocol)
handler := c.protocols[pool.Protocol]
if handler == nil {
