set http listen address solely through the weave script
Previously it was set by the script only in fastdp mode; and in the router's main.go otherwise. Yet every interaction of the script with weave assumes the port is the script's HTTP_PORT=6784. By always starting the router with options to listen on that port we ensure that the router is in fact listening where the script expects it to. In doing this get rid of router.HTTPPort. We do need to hard-code the port in the proxy instead, but relying on router.HTTPPort was flawed anyway, for the above reasons.
This commit is contained in:
1 parent
d3d2863d52
commit
878a12002c
4 files changed
+5
-5
No files matched your search
+1
-1
@@ -85,7 +85,7 @@ func main() {
|
||||
mflag.IntVar(&config.ConnLimit, []string{"#connlimit", "#-connlimit", "-conn-limit"}, 30, "connection limit (0 for unlimited)")
|
||||
mflag.BoolVar(&noDiscovery, []string{"#nodiscovery", "#-nodiscovery", "-no-discovery"}, false, "disable peer discovery")
|
||||
mflag.IntVar(&bufSzMB, []string{"#bufsz", "-bufsz"}, 8, "capture buffer size in MB")
|
||||
mflag.StringVar(&httpAddr, []string{"#httpaddr", "#-httpaddr", "-http-addr"}, fmt.Sprintf(":%d", weave.HTTPPort), "address to bind HTTP interface to (disabled if blank, absolute path indicates unix domain socket)")
|
||||
mflag.StringVar(&httpAddr, []string{"#httpaddr", "#-httpaddr", "-http-addr"}, "", "address to bind HTTP interface to (disabled if blank, absolute path indicates unix domain socket)")
|
||||
mflag.StringVar(&iprangeCIDR, []string{"#iprange", "#-iprange", "-ipalloc-range"}, "", "IP address range reserved for automatic allocation, in CIDR notation")
|
||||
mflag.StringVar(&ipsubnetCIDR, []string{"#ipsubnet", "#-ipsubnet", "-ipalloc-default-subnet"}, "", "subnet to allocate within by default, in CIDR notation")
|
||||
mflag.IntVar(&peerCount, []string{"#initpeercount", "#-initpeercount", "-init-peer-count"}, 0, "number of peers in network (for IP address allocation)")
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ import (
|
||||
. "github.com/weaveworks/weave/common"
|
||||
weavedocker "github.com/weaveworks/weave/common/docker"
|
||||
"github.com/weaveworks/weave/nameserver"
|
||||
"github.com/weaveworks/weave/router"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -490,7 +489,7 @@ func (proxy *Proxy) getDNSDomain() (domain string) {
|
||||
weaveIP = "127.0.0.1"
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://%s:%d/domain", weaveIP, router.HTTPPort)
|
||||
url := fmt.Sprintf("http://%s:6784/domain", weaveIP)
|
||||
resp, err := http.Get(url)
|
||||
if err != nil || resp.StatusCode != http.StatusOK {
|
||||
return
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
const (
|
||||
Port = 6783
|
||||
HTTPPort = Port + 1
|
||||
MaxUDPPacketSize = 65535
|
||||
ChannelSize = 16
|
||||
TCPHeartbeat = 30 * time.Second
|
||||
|
||||
@@ -1463,6 +1463,7 @@ launch_router() {
|
||||
|
||||
if [ "$BRIDGE_TYPE" = fastdp ] ; then
|
||||
NETHOST_OPT="--net=host"
|
||||
HTTP_IP=127.0.0.1
|
||||
# In case there is a lingering veth-weave netdev
|
||||
ip link del $ROUTER_HOSTNETNS_IFNAME >/dev/null 2>&1 || true
|
||||
fi
|
||||
@@ -1481,7 +1482,8 @@ launch_router() {
|
||||
$(router_opts_$BRIDGE_TYPE) \
|
||||
--ipalloc-range "$IPRANGE" \
|
||||
--dns-effective-listen-address $DOCKER_BRIDGE_IP \
|
||||
${NETHOST_OPT:+$DNS_ROUTER_OPTS --http-addr 127.0.0.1:$HTTP_PORT} $NO_DNS_OPT \
|
||||
${NETHOST_OPT:+$DNS_ROUTER_OPTS} $NO_DNS_OPT \
|
||||
--http-addr $HTTP_IP:$HTTP_PORT \
|
||||
--docker-api "unix:///var/run/docker.sock" "$@")
|
||||
with_container_netns_or_die $CONTAINER_NAME setup_router_iface_$BRIDGE_TYPE
|
||||
attach_router
|
||||
|
||||
Reference in new issue
Block a user