From de557a3e0399f6d8d20dc43b34fcb848f47cd5cf Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 31 Mar 2015 11:48:33 +0100 Subject: [PATCH] introduce WEAVEDNS_DOCKER_ARGS same purpuse as WEAVE_DOCKER_ARGS, except for weavedns This allows us to get rid if the -fallback option since WEAVEDNS_DOCKER_ARGS="--dns=..." has the same effect. Closes #487. --- weave | 6 +++++- weavedns/main.go | 12 ------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/weave b/weave index cd13b1a5..ed903cee 100755 --- a/weave +++ b/weave @@ -57,6 +57,7 @@ exec_remote() { -v "$PROCFS":/hostproc \ -e VERSION \ -e WEAVE_DOCKER_ARGS \ + -e WEAVEDNS_DOCKER_ARGS \ -e WEAVE_PASSWORD \ -e DOCKER_BRIDGE \ -e PROCFS=/hostproc --privileged --net=host \ @@ -587,9 +588,12 @@ case "$COMMAND" in check_not_running $DNS_CONTAINER_NAME $BASE_DNS_IMAGE create_bridge docker_bridge_ip + # Set WEAVEDNS_DOCKER_ARGS in the environment in order to supply + # additional parameters, such as resource limits, to docker + # when launching the weave container. DNS_CONTAINER=$(docker run --privileged -d --name=$DNS_CONTAINER_NAME \ -p $DOCKER_BRIDGE_IP:53:53/udp -v /var/run/docker.sock:/var/run/docker.sock \ - $DNS_IMAGE -iface $CONTAINER_IFNAME "$@") + $WEAVEDNS_DOCKER_ARGS $DNS_IMAGE -iface $CONTAINER_IFNAME "$@") with_container_netns $DNS_CONTAINER attach $CIDR >/dev/null populate_dns echo $DNS_CONTAINER diff --git a/weavedns/main.go b/weavedns/main.go index 32c44f31..e7c76e33 100644 --- a/weavedns/main.go +++ b/weavedns/main.go @@ -3,7 +3,6 @@ package main import ( "flag" "fmt" - "github.com/miekg/dns" . "github.com/zettio/weave/common" weavedns "github.com/zettio/weave/nameserver" weavenet "github.com/zettio/weave/net" @@ -23,7 +22,6 @@ func main() { ifaceName string apiPath string localDomain string - fallback string dnsPort int httpPort int wait int @@ -42,7 +40,6 @@ func main() { flag.IntVar(&wait, "wait", 0, "number of seconds to wait for interface to be created and come up") flag.IntVar(&dnsPort, "dnsport", weavedns.DefaultServerPort, "port to listen to DNS requests") flag.IntVar(&httpPort, "httpport", 6785, "port to listen to HTTP requests") - flag.StringVar(&fallback, "fallback", "", "force a fallback (ie, '8.8.8.8:53') instead of /etc/resolv.conf values") flag.IntVar(&timeout, "timeout", weavedns.DefaultTimeout, "timeout for resolutions") flag.IntVar(&udpbuf, "udpbuf", weavedns.DefaultUDPBuflen, "UDP buffer length") flag.IntVar(&cacheLen, "cache", weavedns.DefaultCacheLen, "cache length") @@ -86,15 +83,6 @@ func main() { UDPBufLen: udpbuf, } - if len(fallback) > 0 { - fallbackHost, fallbackPort, err := net.SplitHostPort(fallback) - if err != nil { - Error.Fatal("Could not parse fallback host and port", err) - } - srvConfig.UpstreamCfg = &dns.ClientConfig{Servers: []string{fallbackHost}, Port: fallbackPort} - Debug.Printf("DNS fallback at %s:%s", fallbackHost, fallbackPort) - } - srv, err := weavedns.NewDNSServer(srvConfig, zone, iface) if err != nil { Error.Fatal("Failed to initialize the WeaveDNS server", err)