Skip to content

Commit 8cc9795

Browse files
committed
retry SelectAddress if a race with reconcile causes the route to be removed
1 parent 0fc7026 commit 8cc9795

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
// useful constants for the whole project
88
const (
9-
Version = "0.0.9"
9+
Version = "0.0.10"
1010
EnvPrefix = "VXR_"
1111
NetworkDriver = "vxrNet"
1212
IpamDriver = "vxrIpam"

host/interface.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,14 @@ func (hi *Interface) selectAddress(reqAddress net.IP, propTime time.Duration, xf
315315
return nil, err
316316
}
317317

318+
if numRoutes < 1 {
319+
// The route either wasn't successfully added, or was removed,
320+
// possibly because of a race with reconcile()
321+
// let the outer loop try again
322+
log.Debug("route doesn't exist after it was added")
323+
return nil, nil
324+
}
325+
318326
if numRoutes == 1 {
319327
return addrInSubnet, nil
320328
}

0 commit comments

Comments
 (0)