diff --git a/cmd/containerd/config_linux.go b/cmd/containerd/config_linux.go index 39080d622..6e720c23e 100644 --- a/cmd/containerd/config_linux.go +++ b/cmd/containerd/config_linux.go @@ -1,20 +1,21 @@ package main import ( + "github.com/containerd/containerd/defaults" "github.com/containerd/containerd/server" ) func defaultConfig() *server.Config { return &server.Config{ - Root: server.DefaultRootDir, - State: server.DefaultStateDir, + Root: defaults.DefaultRootDir, + State: defaults.DefaultStateDir, GRPC: server.GRPCConfig{ - Address: server.DefaultAddress, + Address: defaults.DefaultAddress, }, Subreaper: true, Debug: server.Debug{ Level: "info", - Address: server.DefaultDebugAddress, + Address: defaults.DefaultDebugAddress, }, } } diff --git a/cmd/ctr/commands/pprof/pprof.go b/cmd/ctr/commands/pprof/pprof.go index 8192d1135..4e1ee94e7 100644 --- a/cmd/ctr/commands/pprof/pprof.go +++ b/cmd/ctr/commands/pprof/pprof.go @@ -7,7 +7,7 @@ import ( "os" "time" - "github.com/containerd/containerd/server" + "github.com/containerd/containerd/defaults" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -25,7 +25,7 @@ var Command = cli.Command{ cli.StringFlag{ Name: "debug-socket, d", Usage: "socket path for containerd's debug server", - Value: server.DefaultDebugAddress, + Value: defaults.DefaultDebugAddress, }, }, Subcommands: []cli.Command{ diff --git a/cmd/ctr/main.go b/cmd/ctr/main.go index 3b96a0413..e8b2b23ba 100644 --- a/cmd/ctr/main.go +++ b/cmd/ctr/main.go @@ -17,8 +17,8 @@ import ( "github.com/containerd/containerd/cmd/ctr/commands/snapshot" "github.com/containerd/containerd/cmd/ctr/commands/tasks" versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version" + "github.com/containerd/containerd/defaults" "github.com/containerd/containerd/namespaces" - "github.com/containerd/containerd/server" "github.com/containerd/containerd/version" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -57,7 +57,7 @@ containerd CLI cli.StringFlag{ Name: "address, a", Usage: "address for containerd's GRPC server", - Value: server.DefaultAddress, + Value: defaults.DefaultAddress, }, cli.DurationFlag{ Name: "timeout", diff --git a/defaults/defaults.go b/defaults/defaults.go new file mode 100644 index 000000000..d01dbde88 --- /dev/null +++ b/defaults/defaults.go @@ -0,0 +1,16 @@ +// Package defaults provides several common defaults for interacting wtih +// containerd. These can be used on the client-side or server-side. +package defaults + +const ( + // DefaultRootDir is the default location used by containerd to store + // persistent data + DefaultRootDir = "/var/lib/containerd" + // DefaultStateDir is the default location used by containerd to store + // transient data + DefaultStateDir = "/run/containerd" + // DefaultAddress is the default unix socket address + DefaultAddress = "/run/containerd/containerd.sock" + // DefaultDebugAddress is the default unix socket address for pprof data + DefaultDebugAddress = "/run/containerd/debug.sock" +) diff --git a/server/server_linux.go b/server/server_linux.go index b2f5e8b4f..03244e90d 100644 --- a/server/server_linux.go +++ b/server/server_linux.go @@ -10,19 +10,6 @@ import ( specs "github.com/opencontainers/runtime-spec/specs-go" ) -const ( - // DefaultRootDir is the default location used by containerd to store - // persistent data - DefaultRootDir = "/var/lib/containerd" - // DefaultStateDir is the default location used by containerd to store - // transient data - DefaultStateDir = "/run/containerd" - // DefaultAddress is the default unix socket address - DefaultAddress = "/run/containerd/containerd.sock" - // DefaultDebugAddress is the default unix socket address for pprof data - DefaultDebugAddress = "/run/containerd/debug.sock" -) - // apply sets config settings on the server process func apply(ctx context.Context, config *Config) error { if config.Subreaper {