فهرست منبع

daemon: move default namespaces to daemon/config

Keeping the defaults in a single location, which also reduces
the list of imports needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 سال پیش
والد
کامیت
690a6fddf9
4فایلهای تغییر یافته به همراه6 افزوده شده و 12 حذف شده
  1. 2 4
      cmd/dockerd/config.go
  2. 4 0
      daemon/config/config.go
  3. 0 5
      daemon/daemon.go
  4. 0 3
      plugin/executor/containerd/containerd.go

+ 2 - 4
cmd/dockerd/config.go

@@ -3,10 +3,8 @@ package main
 import (
 	"runtime"
 
-	"github.com/docker/docker/daemon"
 	"github.com/docker/docker/daemon/config"
 	"github.com/docker/docker/opts"
-	"github.com/docker/docker/plugin/executor/containerd"
 	"github.com/docker/docker/registry"
 	"github.com/spf13/pflag"
 )
@@ -96,8 +94,8 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
 	conf.MaxConcurrentUploads = &maxConcurrentUploads
 	conf.MaxDownloadAttempts = &maxDownloadAttempts
 
-	flags.StringVar(&conf.ContainerdNamespace, "containerd-namespace", daemon.ContainersNamespace, "Containerd namespace to use")
-	flags.StringVar(&conf.ContainerdPluginNamespace, "containerd-plugins-namespace", containerd.PluginNamespace, "Containerd namespace to use for plugins")
+	flags.StringVar(&conf.ContainerdNamespace, "containerd-namespace", config.DefaultContainersNamespace, "Containerd namespace to use")
+	flags.StringVar(&conf.ContainerdPluginNamespace, "containerd-plugins-namespace", config.DefaultPluginNamespace, "Containerd namespace to use for plugins")
 
 	flags.StringVar(&conf.DefaultRuntime, "default-runtime", config.StockRuntimeName, "Default OCI runtime for containers")
 

+ 4 - 0
daemon/config/config.go

@@ -43,6 +43,10 @@ const (
 	// DefaultRuntimeBinary is the default runtime to be used by
 	// containerd if none is specified
 	DefaultRuntimeBinary = "runc"
+	// DefaultContainersNamespace is the name of the default containerd namespace used for users containers.
+	DefaultContainersNamespace = "moby"
+	// DefaultPluginNamespace is the name of the default containerd namespace used for plugins.
+	DefaultPluginNamespace = "plugins.moby"
 
 	// LinuxV1RuntimeName is the runtime used to specify the containerd v1 shim with the runc binary
 	// Note this is different than io.containerd.runc.v1 which would be the v1 shim using the v2 shim API.

+ 0 - 5
daemon/daemon.go

@@ -69,11 +69,6 @@ import (
 	"google.golang.org/grpc/credentials/insecure"
 )
 
-// ContainersNamespace is the name of the namespace used for users containers
-const (
-	ContainersNamespace = "moby"
-)
-
 var (
 	errSystemNotSupported = errors.New("the Docker daemon is not supported on this platform")
 )

+ 0 - 3
plugin/executor/containerd/containerd.go

@@ -16,9 +16,6 @@ import (
 	"github.com/sirupsen/logrus"
 )
 
-// PluginNamespace is the name used for the plugins namespace
-const PluginNamespace = "plugins.moby"
-
 // ExitHandler represents an object that is called when the exit event is received from containerd
 type ExitHandler interface {
 	HandleExitEvent(id string) error