1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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 16b9fc994e
commit 721518279a
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"},