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:
parent
16b9fc994e
commit
721518279a
8 changed files with 18 additions and 16 deletions
|
@ -35,6 +35,7 @@ type Config struct {
|
||||||
// DaemonCfg represents libnetwork core configuration
|
// DaemonCfg represents libnetwork core configuration
|
||||||
type DaemonCfg struct {
|
type DaemonCfg struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
|
Experimental bool
|
||||||
DataDir string
|
DataDir string
|
||||||
DefaultNetwork string
|
DefaultNetwork string
|
||||||
DefaultDriver 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
|
// ProcessOptions processes options and stores it in config
|
||||||
func (c *Config) ProcessOptions(options ...Option) {
|
func (c *Config) ProcessOptions(options ...Option) {
|
||||||
for _, opt := range options {
|
for _, opt := range options {
|
||||||
|
|
|
@ -188,7 +188,7 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, i := range getInitializers() {
|
for _, i := range getInitializers(c.cfg.Daemon.Experimental) {
|
||||||
var dcfg map[string]interface{}
|
var dcfg map[string]interface{}
|
||||||
|
|
||||||
// External plugins don't need config passed through daemon. They can
|
// 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 {
|
func (c *controller) BuiltinDrivers() []string {
|
||||||
drivers := []string{}
|
drivers := []string{}
|
||||||
for _, i := range getInitializers() {
|
for _, i := range getInitializers(c.cfg.Daemon.Experimental) {
|
||||||
if i.ntype == "remote" {
|
if i.ntype == "remote" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// +build experimental
|
|
||||||
|
|
||||||
package libnetwork
|
package libnetwork
|
||||||
|
|
||||||
import "github.com/docker/libnetwork/drivers/ipvlan"
|
import "github.com/docker/libnetwork/drivers/ipvlan"
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"github.com/docker/libnetwork/drivers/remote"
|
"github.com/docker/libnetwork/drivers/remote"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getInitializers() []initializer {
|
func getInitializers(experimental bool) []initializer {
|
||||||
return []initializer{
|
return []initializer{
|
||||||
{null.Init, "null"},
|
{null.Init, "null"},
|
||||||
{remote.Init, "remote"},
|
{remote.Init, "remote"},
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/docker/libnetwork/drivers/remote"
|
"github.com/docker/libnetwork/drivers/remote"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getInitializers() []initializer {
|
func getInitializers(experimental bool) []initializer {
|
||||||
in := []initializer{
|
in := []initializer{
|
||||||
{bridge.Init, "bridge"},
|
{bridge.Init, "bridge"},
|
||||||
{host.Init, "host"},
|
{host.Init, "host"},
|
||||||
|
@ -19,6 +19,8 @@ func getInitializers() []initializer {
|
||||||
{overlay.Init, "overlay"},
|
{overlay.Init, "overlay"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if experimental {
|
||||||
in = append(in, additionalDrivers()...)
|
in = append(in, additionalDrivers()...)
|
||||||
|
}
|
||||||
return in
|
return in
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/docker/libnetwork/drivers/solaris/overlay"
|
"github.com/docker/libnetwork/drivers/solaris/overlay"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getInitializers() []initializer {
|
func getInitializers(experimental bool) []initializer {
|
||||||
return []initializer{
|
return []initializer{
|
||||||
{overlay.Init, "overlay"},
|
{overlay.Init, "overlay"},
|
||||||
{bridge.Init, "bridge"},
|
{bridge.Init, "bridge"},
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
// +build !experimental
|
|
||||||
|
|
||||||
package libnetwork
|
|
||||||
|
|
||||||
func additionalDrivers() []initializer {
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/docker/libnetwork/drivers/windows/overlay"
|
"github.com/docker/libnetwork/drivers/windows/overlay"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getInitializers() []initializer {
|
func getInitializers(experimental bool) []initializer {
|
||||||
return []initializer{
|
return []initializer{
|
||||||
{null.Init, "null"},
|
{null.Init, "null"},
|
||||||
{overlay.Init, "overlay"},
|
{overlay.Init, "overlay"},
|
||||||
|
|
Loading…
Reference in a new issue