Add the datapath-addr in libnetwork#1719
Conversation
| if err := c.agentInit(listenAddr, bindAddr, advAddr); err != nil { | ||
| logrus.Infof("Initializing Libnetwork Agent Listen-Addr=%s Local-addr=%s Adv-addr=%s Data-addr=%s Remote-addr =%s", | ||
| listenAddr, bindAddr, advAddr, dataAddr, remoteAddr) | ||
| if advAddr != "" && dataAddr != "" && agent == nil { |
There was a problem hiding this comment.
dataAddr != "" should not be a requisite for starting the networking agent
There was a problem hiding this comment.
In the deamon side, it is always set to something, if the flag is passed will contain the value, else will be fallback to the adv address
There was a problem hiding this comment.
We should not assume how the caller will pass these values.
From libnetwork point of view, all what is needed to start the agent is the advertise address being set.
| d.DiscoverNew(discoverapi.NodeDiscovery, discoverapi.NodeDiscoveryData{ | ||
| Address: agent.advertiseAddr, | ||
| if err := d.DiscoverNew(discoverapi.NodeDiscovery, discoverapi.NodeDiscoveryData{ | ||
| Address: agent.dataPathAddr, |
There was a problem hiding this comment.
On the same line, the decision of setting Address: agent.dataPathAddr or Address: agent.advertiseAddr IMO should be taken by libnetwork code based on the fact if agent.dataPathAddr != ""
| ch, cancel := nDB.Watch(libnetworkEPTable, "", "") | ||
| nodeCh, cancel := nDB.Watch(networkdb.NodeTable, "", "") | ||
|
|
||
| dpAddr := dataPathAddr |
There was a problem hiding this comment.
What about preserving the original agent parameters and add a method instead:
func (a *agent) datapathAddress() string {
a.Lock()
defer a.Unlock()
if a.dataPathAddr != "" {
return a.dataPathAddr
}
return a.advertiseAddr
}
|
With the Though its beyond the scope of this PR making a comment here so that we can consider it in the design. |
|
@sanimej agree, having the info in the inspect sounds a very good idea to me, will look into it |
aboch
left a comment
There was a problem hiding this comment.
Thanks for taking care of the comments.
LGTM
During configuration in SWARM mode is now possible to pass an additional parameter --data-path-addr <ip|interface>. The information is going to be used to configure which is the interface that is going to be used for the data path for global scope drivers. Up to now the only driver really using this extra parameter is the overlay driver. Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
During configuration in SWARM mode is now possible to pass an additional
parameter --datapath-addr <ip|interface>.
The information is going to be used to configure which is the interface
that is going to be used for the data path for global scope drivers.
Up to now the only driver really using this extra parameter is the
overlay driver.
Signed-off-by: Flavio Crisciani flavio.crisciani@docker.com