Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -54,8 +54,6 @@ import ( |
| 54 | 54 |
"github.com/docker/docker/pkg/pidfile" |
| 55 | 55 |
"github.com/docker/docker/pkg/plugingetter" |
| 56 | 56 |
"github.com/docker/docker/pkg/rootless" |
| 57 |
- "github.com/docker/docker/pkg/sysinfo" |
|
| 58 |
- "github.com/docker/docker/runconfig" |
|
| 59 | 57 |
"github.com/docker/go-connections/tlsconfig" |
| 60 | 58 |
"github.com/moby/buildkit/session" |
| 61 | 59 |
"github.com/moby/buildkit/util/tracing/detect" |
| ... | ... |
@@ -704,16 +702,10 @@ func normalizeHosts(cfg *config.Config) error {
|
| 704 | 704 |
} |
| 705 | 705 |
|
| 706 | 706 |
func buildRouters(opts routerOptions) []router.Router {
|
| 707 |
- decoder := runconfig.ContainerDecoder{
|
|
| 708 |
- GetSysInfo: func() *sysinfo.SysInfo {
|
|
| 709 |
- return opts.daemon.RawSysInfo() |
|
| 710 |
- }, |
|
| 711 |
- } |
|
| 712 |
- |
|
| 713 | 707 |
routers := []router.Router{
|
| 714 | 708 |
// we need to add the checkpoint router before the container router or the DELETE gets masked |
| 715 | 709 |
checkpointrouter.NewRouter(opts.daemon), |
| 716 |
- container.NewRouter(opts.daemon, decoder, opts.daemon.RawSysInfo().CgroupUnified), |
|
| 710 |
+ container.NewRouter(opts.daemon, opts.daemon.RawSysInfo()), |
|
| 717 | 711 |
image.NewRouter( |
| 718 | 712 |
opts.daemon.ImageService(), |
| 719 | 713 |
opts.daemon.RegistryService(), |
| 720 | 714 |
deleted file mode 100644 |
| ... | ... |
@@ -1,15 +0,0 @@ |
| 1 |
-package httputils |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "io" |
|
| 5 |
- |
|
| 6 |
- "github.com/moby/moby/api/types/container" |
|
| 7 |
- "github.com/moby/moby/api/types/network" |
|
| 8 |
-) |
|
| 9 |
- |
|
| 10 |
-// ContainerDecoder specifies how |
|
| 11 |
-// to translate an io.Reader into |
|
| 12 |
-// container configuration. |
|
| 13 |
-type ContainerDecoder interface {
|
|
| 14 |
- DecodeConfig(src io.Reader) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error) |
|
| 15 |
-} |
| ... | ... |
@@ -1,24 +1,29 @@ |
| 1 | 1 |
package container |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "github.com/docker/docker/daemon/server/httputils" |
|
| 5 | 4 |
"github.com/docker/docker/daemon/server/router" |
| 5 |
+ "github.com/docker/docker/pkg/sysinfo" |
|
| 6 |
+ "github.com/docker/docker/runconfig" |
|
| 6 | 7 |
) |
| 7 | 8 |
|
| 8 | 9 |
// containerRouter is a router to talk with the container controller |
| 9 | 10 |
type containerRouter struct {
|
| 10 | 11 |
backend Backend |
| 11 |
- decoder httputils.ContainerDecoder |
|
| 12 |
+ decoder runconfig.ContainerDecoder |
|
| 12 | 13 |
routes []router.Route |
| 13 | 14 |
cgroup2 bool |
| 14 | 15 |
} |
| 15 | 16 |
|
| 16 | 17 |
// NewRouter initializes a new container router |
| 17 |
-func NewRouter(b Backend, decoder httputils.ContainerDecoder, cgroup2 bool) router.Router {
|
|
| 18 |
+func NewRouter(b Backend, sysInfo *sysinfo.SysInfo) router.Router {
|
|
| 18 | 19 |
r := &containerRouter{
|
| 19 | 20 |
backend: b, |
| 20 |
- decoder: decoder, |
|
| 21 |
- cgroup2: cgroup2, |
|
| 21 |
+ decoder: runconfig.ContainerDecoder{
|
|
| 22 |
+ GetSysInfo: func() *sysinfo.SysInfo {
|
|
| 23 |
+ return sysInfo |
|
| 24 |
+ }, |
|
| 25 |
+ }, |
|
| 26 |
+ cgroup2: sysInfo.CgroupUnified, |
|
| 22 | 27 |
} |
| 23 | 28 |
r.initRoutes() |
| 24 | 29 |
return r |