diff --git a/plugin/net/driver.go b/plugin/net/driver.go index 4d555a80..14a301a7 100644 --- a/plugin/net/driver.go +++ b/plugin/net/driver.go @@ -31,18 +31,18 @@ type driver struct { name string scope string docker *docker.Client - noDNS bool + dns bool isPluginV2 bool sync.RWMutex networks map[string]network } -func New(client *docker.Client, weave *weaveapi.Client, name, scope string, noDNS, isPluginV2 bool) (skel.Driver, error) { +func New(client *docker.Client, weave *weaveapi.Client, name, scope string, dns, isPluginV2 bool) (skel.Driver, error) { driver := &driver{ name: name, scope: scope, docker: client, - noDNS: noDNS, + dns: dns, isPluginV2: isPluginV2, networks: make(map[string]network), } diff --git a/plugin/net/watcher.go b/plugin/net/watcher.go index c0d38f79..736751d7 100644 --- a/plugin/net/watcher.go +++ b/plugin/net/watcher.go @@ -41,7 +41,7 @@ func (w *watcher) ContainerStarted(id string) { continue } if network.isOurs { - if !w.driver.noDNS { + if w.driver.dns { fqdn := fmt.Sprintf("%s.%s", info.Config.Hostname, info.Config.Domainname) if err := w.weave.RegisterWithDNS(id, fqdn, net.IPAddress); err != nil { w.driver.warn("ContainerStarted", "unable to register %s with weaveDNS: %s", id, err) diff --git a/plugin/plugin.go b/plugin/plugin.go index e850d567..8a9c48f6 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -20,23 +20,23 @@ import ( var Log = common.Log -func Start(weaveAPIAddr string, dockerClient *docker.Client, address string, meshAddress string, noDNS bool, isPluginV2 bool) { +func Start(weaveAPIAddr string, dockerClient *docker.Client, address string, meshAddress string, dns bool, isPluginV2 bool) { weave := weaveapi.NewClient(weaveAPIAddr, Log) Log.Info("Waiting for Weave API Server...") weave.WaitAPIServer(30) Log.Info("Finished waiting for Weave API Server") - if err := run(dockerClient, weave, address, meshAddress, noDNS, isPluginV2); err != nil { + if err := run(dockerClient, weave, address, meshAddress, dns, isPluginV2); err != nil { Log.Fatal(err) } } -func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddress string, noDNS, isPluginV2 bool) error { +func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddress string, dns, isPluginV2 bool) error { endChan := make(chan error, 1) if address != "" { - globalListener, err := listenAndServe(dockerClient, weave, address, endChan, "global", false, noDNS, isPluginV2) + globalListener, err := listenAndServe(dockerClient, weave, address, endChan, "global", false, dns, isPluginV2) if err != nil { return err } @@ -44,7 +44,7 @@ func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddre defer globalListener.Close() } if meshAddress != "" { - meshListener, err := listenAndServe(dockerClient, weave, meshAddress, endChan, "local", true, noDNS, isPluginV2) + meshListener, err := listenAndServe(dockerClient, weave, meshAddress, endChan, "local", true, dns, isPluginV2) if err != nil { return err } @@ -61,10 +61,10 @@ func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddre return <-endChan } -func listenAndServe(dockerClient *docker.Client, weave *weaveapi.Client, address string, endChan chan<- error, scope string, withIpam, noDNS bool, isPluginV2 bool) (net.Listener, error) { +func listenAndServe(dockerClient *docker.Client, weave *weaveapi.Client, address string, endChan chan<- error, scope string, withIpam, dns bool, isPluginV2 bool) (net.Listener, error) { name := strings.TrimSuffix(path.Base(address), ".sock") // TODO(mp) fix plugin name, as it is used to determine whether network is our - d, err := netplugin.New(dockerClient, weave, name, scope, noDNS, isPluginV2) + d, err := netplugin.New(dockerClient, weave, name, scope, dns, isPluginV2) if err != nil { return nil, err } diff --git a/prog/weaver/main.go b/prog/weaver/main.go index 926630e3..7982a2fb 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -407,7 +407,7 @@ func main() { } if enablePlugin || enablePluginV2 { - go plugin.Start(httpAddr, dockerCli, pluginSocket, pluginMeshSocket, noDNS, enablePluginV2) + go plugin.Start(httpAddr, dockerCli, pluginSocket, pluginMeshSocket, !noDNS, enablePluginV2) } signals.SignalHandlerLoop(common.Log, router)