Browse code

Vendor libnetwork with experimental daemon flag handling

Signed-off-by: Madhu Venugopal <madhu@docker.com>

Madhu Venugopal authored on 2016/12/14 06:45:30
Showing 9 changed files
... ...
@@ -23,7 +23,7 @@ github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5
23 23
 github.com/imdario/mergo 0.2.1
24 24
 
25 25
 #get libnetwork packages
26
-github.com/docker/libnetwork 4df06c4a7d9b67d0948eab39c5d013d7296acdbf
26
+github.com/docker/libnetwork b908488a139e81cb8c4091cd836745aeb4d813a4
27 27
 github.com/docker/go-events 18b43f1bc85d9cdd42c05a6cd2d444c7a200a894
28 28
 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
29 29
 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
... ...
@@ -35,6 +35,7 @@ type Config struct {
35 35
 // DaemonCfg represents libnetwork core configuration
36 36
 type DaemonCfg struct {
37 37
 	Debug           bool
38
+	Experimental    bool
38 39
 	DataDir         string
39 40
 	DefaultNetwork  string
40 41
 	DefaultDriver   string
... ...
@@ -222,6 +223,14 @@ func OptionPluginGetter(pg plugingetter.PluginGetter) Option {
222 222
 	}
223 223
 }
224 224
 
225
+// OptionExperimental function returns an option setter for experimental daemon
226
+func OptionExperimental(exp bool) Option {
227
+	return func(c *Config) {
228
+		logrus.Debugf("Option Experimental: %v", exp)
229
+		c.Daemon.Experimental = exp
230
+	}
231
+}
232
+
225 233
 // ProcessOptions processes options and stores it in config
226 234
 func (c *Config) ProcessOptions(options ...Option) {
227 235
 	for _, opt := range options {
... ...
@@ -188,7 +188,7 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
188 188
 		return nil, err
189 189
 	}
190 190
 
191
-	for _, i := range getInitializers() {
191
+	for _, i := range getInitializers(c.cfg.Daemon.Experimental) {
192 192
 		var dcfg map[string]interface{}
193 193
 
194 194
 		// External plugins don't need config passed through daemon. They can
... ...
@@ -476,7 +476,7 @@ func (c *controller) ID() string {
476 476
 
477 477
 func (c *controller) BuiltinDrivers() []string {
478 478
 	drivers := []string{}
479
-	for _, i := range getInitializers() {
479
+	for _, i := range getInitializers(c.cfg.Daemon.Experimental) {
480 480
 		if i.ntype == "remote" {
481 481
 			continue
482 482
 		}
... ...
@@ -1,5 +1,3 @@
1
-// +build experimental
2
-
3 1
 package libnetwork
4 2
 
5 3
 import "github.com/docker/libnetwork/drivers/ipvlan"
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"github.com/docker/libnetwork/drivers/remote"
6 6
 )
7 7
 
8
-func getInitializers() []initializer {
8
+func getInitializers(experimental bool) []initializer {
9 9
 	return []initializer{
10 10
 		{null.Init, "null"},
11 11
 		{remote.Init, "remote"},
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"github.com/docker/libnetwork/drivers/remote"
10 10
 )
11 11
 
12
-func getInitializers() []initializer {
12
+func getInitializers(experimental bool) []initializer {
13 13
 	in := []initializer{
14 14
 		{bridge.Init, "bridge"},
15 15
 		{host.Init, "host"},
... ...
@@ -19,6 +19,8 @@ func getInitializers() []initializer {
19 19
 		{overlay.Init, "overlay"},
20 20
 	}
21 21
 
22
-	in = append(in, additionalDrivers()...)
22
+	if experimental {
23
+		in = append(in, additionalDrivers()...)
24
+	}
23 25
 	return in
24 26
 }
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"github.com/docker/libnetwork/drivers/solaris/overlay"
7 7
 )
8 8
 
9
-func getInitializers() []initializer {
9
+func getInitializers(experimental bool) []initializer {
10 10
 	return []initializer{
11 11
 		{overlay.Init, "overlay"},
12 12
 		{bridge.Init, "bridge"},
13 13
deleted file mode 100644
... ...
@@ -1,7 +0,0 @@
1
-// +build !experimental
2
-
3
-package libnetwork
4
-
5
-func additionalDrivers() []initializer {
6
-	return nil
7
-}
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"github.com/docker/libnetwork/drivers/windows/overlay"
8 8
 )
9 9
 
10
-func getInitializers() []initializer {
10
+func getInitializers(experimental bool) []initializer {
11 11
 	return []initializer{
12 12
 		{null.Init, "null"},
13 13
 		{overlay.Init, "overlay"},