Update the local VTEP in peerdb on receiving self discovery
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
This commit is contained in:
parent
1ee6e5b30b
commit
4208a2f75a
|
@ -48,6 +48,7 @@ type driver struct {
|
||||||
vxlanIdm *idm.Idm
|
vxlanIdm *idm.Idm
|
||||||
once sync.Once
|
once sync.Once
|
||||||
joinOnce sync.Once
|
joinOnce sync.Once
|
||||||
|
localJoinOnce sync.Once
|
||||||
keys []*key
|
keys []*key
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
}
|
}
|
||||||
|
@ -241,6 +242,12 @@ func (d *driver) nodeJoin(advertiseAddress, bindAddress string, self bool) {
|
||||||
d.bindAddress = bindAddress
|
d.bindAddress = bindAddress
|
||||||
d.Unlock()
|
d.Unlock()
|
||||||
|
|
||||||
|
// If containers are already running on this network update the
|
||||||
|
// advertiseaddress in the peerDB
|
||||||
|
d.localJoinOnce.Do(func() {
|
||||||
|
d.peerDBUpdateSelf()
|
||||||
|
})
|
||||||
|
|
||||||
// If there is no cluster store there is no need to start serf.
|
// If there is no cluster store there is no need to start serf.
|
||||||
if d.store != nil {
|
if d.store != nil {
|
||||||
if err := validateSelf(advertiseAddress); err != nil {
|
if err := validateSelf(advertiseAddress); err != nil {
|
||||||
|
|
|
@ -367,3 +367,12 @@ func (d *driver) pushLocalDb() {
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *driver) peerDBUpdateSelf() {
|
||||||
|
d.peerDbWalk(func(nid string, pkey *peerKey, pEntry *peerEntry) bool {
|
||||||
|
if pEntry.isLocal {
|
||||||
|
pEntry.vtep = net.ParseIP(d.advertiseAddress)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue