Handling the new experimental daemon flag

related to https://github.com/docker/docker/issues/29368

Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
Madhu Venugopal 2016-12-13 13:22:55 -08:00
parent 4df06c4a7d
commit 14b2be6d74
8 changed files with 18 additions and 16 deletions

View File

@ -35,6 +35,7 @@ type Config struct {
// DaemonCfg represents libnetwork core configuration
type DaemonCfg struct {
Debug bool
Experimental bool
DataDir string
DefaultNetwork string
DefaultDriver string
@ -222,6 +223,14 @@ func OptionPluginGetter(pg plugingetter.PluginGetter) Option {
}
}
// OptionExperimental function returns an option setter for experimental daemon
func OptionExperimental(exp bool) Option {
return func(c *Config) {
logrus.Debugf("Option Experimental: %v", exp)
c.Daemon.Experimental = exp
}
}
// ProcessOptions processes options and stores it in config
func (c *Config) ProcessOptions(options ...Option) {
for _, opt := range options {

View File

@ -188,7 +188,7 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
return nil, err
}
for _, i := range getInitializers() {
for _, i := range getInitializers(c.cfg.Daemon.Experimental) {
var dcfg map[string]interface{}
// External plugins don't need config passed through daemon. They can
@ -476,7 +476,7 @@ func (c *controller) ID() string {
func (c *controller) BuiltinDrivers() []string {
drivers := []string{}
for _, i := range getInitializers() {
for _, i := range getInitializers(c.cfg.Daemon.Experimental) {
if i.ntype == "remote" {
continue
}

View File

@ -1,5 +1,3 @@
// +build experimental
package libnetwork
import "github.com/docker/libnetwork/drivers/ipvlan"

View File

@ -5,7 +5,7 @@ import (
"github.com/docker/libnetwork/drivers/remote"
)
func getInitializers() []initializer {
func getInitializers(experimental bool) []initializer {
return []initializer{
{null.Init, "null"},
{remote.Init, "remote"},

View File

@ -9,7 +9,7 @@ import (
"github.com/docker/libnetwork/drivers/remote"
)
func getInitializers() []initializer {
func getInitializers(experimental bool) []initializer {
in := []initializer{
{bridge.Init, "bridge"},
{host.Init, "host"},
@ -19,6 +19,8 @@ func getInitializers() []initializer {
{overlay.Init, "overlay"},
}
in = append(in, additionalDrivers()...)
if experimental {
in = append(in, additionalDrivers()...)
}
return in
}

View File

@ -6,7 +6,7 @@ import (
"github.com/docker/libnetwork/drivers/solaris/overlay"
)
func getInitializers() []initializer {
func getInitializers(experimental bool) []initializer {
return []initializer{
{overlay.Init, "overlay"},
{bridge.Init, "bridge"},

View File

@ -1,7 +0,0 @@
// +build !experimental
package libnetwork
func additionalDrivers() []initializer {
return nil
}

View File

@ -7,7 +7,7 @@ import (
"github.com/docker/libnetwork/drivers/windows/overlay"
)
func getInitializers() []initializer {
func getInitializers(experimental bool) []initializer {
return []initializer{
{null.Init, "null"},
{overlay.Init, "overlay"},