Merge pull request #1777 from weaveworks/remove-plugin-nameserver-option

Remove 'nameserver' option from plugin
This commit is contained in:
Adam Harrison committed 2016-01-29 15:24:04 +00:00
commit 5fbceb0f78
2 files changed
+5 -17

No files matched your search

+1 -11
View File
@@ -22,16 +22,14 @@ const (
type driver struct { type driver struct {
version string version string
nameserver string
scope string scope string
noMulticastRoute bool noMulticastRoute bool
sync.RWMutex sync.RWMutex
endpoints map[string]struct{} endpoints map[string]struct{}
} }
func New(client *docker.Client, version string, nameserver string, scope string, noMulticastRoute bool) (skel.Driver, error) { func New(client *docker.Client, version string, scope string, noMulticastRoute bool) (skel.Driver, error) {
driver := &driver{ driver := &driver{
nameserver: nameserver,
noMulticastRoute: noMulticastRoute, noMulticastRoute: noMulticastRoute,
version: version, version: version,
scope: scope, scope: scope,
@@ -156,14 +154,6 @@ func (driver *driver) JoinEndpoint(j *api.JoinRequest) (*api.JoinResponse, error
response := &api.JoinResponse{ response := &api.JoinResponse{
InterfaceName: ifname, InterfaceName: ifname,
} }
if driver.nameserver != "" {
routeToDNS := api.StaticRoute{
Destination: driver.nameserver + "/32",
RouteType: types.CONNECTED,
NextHop: "",
}
response.StaticRoutes = []api.StaticRoute{routeToDNS}
}
if !driver.noMulticastRoute { if !driver.noMulticastRoute {
multicastRoute := api.StaticRoute{ multicastRoute := api.StaticRoute{
Destination: "224.0.0.0/4", Destination: "224.0.0.0/4",
+4 -6
View File
@@ -20,7 +20,6 @@ func main() {
var ( var (
justVersion bool justVersion bool
address string address string
nameserver string
meshAddress string meshAddress string
logLevel string logLevel string
noMulticastRoute bool noMulticastRoute bool
@@ -29,7 +28,6 @@ func main() {
flag.BoolVar(&justVersion, "version", false, "print version and exit") flag.BoolVar(&justVersion, "version", false, "print version and exit")
flag.StringVar(&logLevel, "log-level", "info", "logging level (debug, info, warning, error)") flag.StringVar(&logLevel, "log-level", "info", "logging level (debug, info, warning, error)")
flag.StringVar(&address, "socket", "/run/docker/plugins/weave.sock", "socket on which to listen") flag.StringVar(&address, "socket", "/run/docker/plugins/weave.sock", "socket on which to listen")
flag.StringVar(&nameserver, "nameserver", "", "nameserver to provide to containers")
flag.StringVar(&meshAddress, "meshsocket", "/run/docker/plugins/weavemesh.sock", "socket on which to listen in mesh mode") flag.StringVar(&meshAddress, "meshsocket", "/run/docker/plugins/weavemesh.sock", "socket on which to listen in mesh mode")
flag.BoolVar(&noMulticastRoute, "no-multicast-route", false, "do not add a multicast route to network endpoints") flag.BoolVar(&noMulticastRoute, "no-multicast-route", false, "do not add a multicast route to network endpoints")
@@ -53,14 +51,14 @@ func main() {
endChan := make(chan error, 1) endChan := make(chan error, 1)
if address != "" { if address != "" {
globalListener, err := listenAndServe(dockerClient, address, nameserver, noMulticastRoute, endChan, "global", false) globalListener, err := listenAndServe(dockerClient, address, noMulticastRoute, endChan, "global", false)
if err != nil { if err != nil {
Log.Fatalf("unable to create driver: %s", err) Log.Fatalf("unable to create driver: %s", err)
} }
defer globalListener.Close() defer globalListener.Close()
} }
if meshAddress != "" { if meshAddress != "" {
meshListener, err := listenAndServe(dockerClient, meshAddress, nameserver, noMulticastRoute, endChan, "local", true) meshListener, err := listenAndServe(dockerClient, meshAddress, noMulticastRoute, endChan, "local", true)
if err != nil { if err != nil {
Log.Fatalf("unable to create driver: %s", err) Log.Fatalf("unable to create driver: %s", err)
} }
@@ -74,8 +72,8 @@ func main() {
} }
} }
func listenAndServe(dockerClient *docker.Client, address, nameserver string, noMulticastRoute bool, endChan chan<- error, scope string, withIpam bool) (net.Listener, error) { func listenAndServe(dockerClient *docker.Client, address string, noMulticastRoute bool, endChan chan<- error, scope string, withIpam bool) (net.Listener, error) {
d, err := netplugin.New(dockerClient, version, nameserver, scope, noMulticastRoute) d, err := netplugin.New(dockerClient, version, scope, noMulticastRoute)
if err != nil { if err != nil {
return nil, err return nil, err
} }