Skip to content

Commit dd241d7

Browse files
committed
fix: don't announce the VIP on acquire failure
I noticed that while looking at #8493, but I don't know if this problem actually happened in real life. If acquiring a VIP fails (which can only fail for Equinix/HCloud, not L2 ARP announce), we should not set the leader flag, as it would make the controller announce the IP, while it shouldn't do that. If this call fails, there's no matching call to de-announce on failure. The bug would show up as two nodes having same VIP assigned on the host. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com> (cherry picked from commit 5c0f74b)
1 parent 67c76e8 commit dd241d7

File tree

1 file changed

+6
-0
lines changed
  • internal/app/machined/pkg/controllers/network/operator

1 file changed

+6
-0
lines changed

internal/app/machined/pkg/controllers/network/operator/vip.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ func (vip *VIP) markAsLeader(ctx context.Context, notifyCh chan<- struct{}, lead
366366

367367
if leader {
368368
handlerErr = vip.handler.Acquire(ctx)
369+
370+
if handlerErr != nil {
371+
// if failed to acquire, we are not a leader, we will resign from the election
372+
// so don't mark as leader, so that Talos doesn't announce IPs on the host
373+
leader = false
374+
}
369375
} else {
370376
handlerErr = vip.handler.Release(ctx)
371377
}

0 commit comments

Comments
 (0)