daemon: remove support for deprecated io.containerd.runtime.v1.linux

This has been deprecated in Docker 20.10.0 (f63f73a4a8)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2022-06-05 18:17:43 +09:00
parent 4734f1e8c9
commit 2c7a6d7bb1
No known key found for this signature in database
GPG key ID: 49524C6F9F638F1A
4 changed files with 0 additions and 38 deletions

View file

@ -51,10 +51,6 @@ const (
// DefaultPluginNamespace is the name of the default containerd namespace used for plugins. // DefaultPluginNamespace is the name of the default containerd namespace used for plugins.
DefaultPluginNamespace = "plugins.moby" 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.
// This is specifically for the v1 shim using the v1 shim API.
LinuxV1RuntimeName = "io.containerd.runtime.v1.linux"
// LinuxV2RuntimeName is the runtime used to specify the containerd v2 runc shim // LinuxV2RuntimeName is the runtime used to specify the containerd v2 runc shim
LinuxV2RuntimeName = "io.containerd.runc.v2" LinuxV2RuntimeName = "io.containerd.runc.v2"
@ -67,7 +63,6 @@ const (
var builtinRuntimes = map[string]bool{ var builtinRuntimes = map[string]bool{
StockRuntimeName: true, StockRuntimeName: true,
LinuxV1RuntimeName: true,
LinuxV2RuntimeName: true, LinuxV2RuntimeName: true,
} }

View file

@ -727,10 +727,6 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
} }
} }
if hostConfig.Runtime == config.LinuxV1RuntimeName || (hostConfig.Runtime == "" && daemon.configStore.DefaultRuntime == config.LinuxV1RuntimeName) {
warnings = append(warnings, fmt.Sprintf("Configured runtime %q is deprecated and will be removed in the next release.", config.LinuxV1RuntimeName))
}
return warnings, nil return warnings, nil
} }
@ -770,9 +766,6 @@ func verifyDaemonSettings(conf *config.Config) error {
if conf.GetRuntime(rtName) == nil { if conf.GetRuntime(rtName) == nil {
return fmt.Errorf("specified default runtime '%s' does not exist", rtName) return fmt.Errorf("specified default runtime '%s' does not exist", rtName)
} }
if rtName == config.LinuxV1RuntimeName {
logrus.Warnf("Configured default runtime %q is deprecated and will be removed in the next release.", config.LinuxV1RuntimeName)
}
} }
return nil return nil
} }

View file

@ -72,10 +72,6 @@ func (daemon *Daemon) SystemInfo() *types.Info {
daemon.fillLicense(v) daemon.fillLicense(v)
daemon.fillDefaultAddressPools(v) daemon.fillDefaultAddressPools(v)
if v.DefaultRuntime == config.LinuxV1RuntimeName {
v.Warnings = append(v.Warnings, fmt.Sprintf("Configured default runtime %q is deprecated and will be removed in the next release.", config.LinuxV1RuntimeName))
}
return v return v
} }

View file

@ -10,8 +10,6 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/containerd/cgroups"
"github.com/containerd/containerd/runtime/linux/runctypes"
v2runcoptions "github.com/containerd/containerd/runtime/v2/runc/options" v2runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/daemon/config" "github.com/docker/docker/daemon/config"
@ -24,7 +22,6 @@ import (
const ( const (
defaultRuntimeName = "runc" defaultRuntimeName = "runc"
linuxShimV1 = "io.containerd.runtime.v1.linux"
linuxShimV2 = "io.containerd.runc.v2" linuxShimV2 = "io.containerd.runc.v2"
) )
@ -35,7 +32,6 @@ func configureRuntimes(conf *config.Config) {
if conf.Runtimes == nil { if conf.Runtimes == nil {
conf.Runtimes = make(map[string]types.Runtime) conf.Runtimes = make(map[string]types.Runtime)
} }
conf.Runtimes[config.LinuxV1RuntimeName] = types.Runtime{Path: defaultRuntimeName, Shim: defaultV1ShimConfig(conf, defaultRuntimeName)}
conf.Runtimes[config.LinuxV2RuntimeName] = types.Runtime{Path: defaultRuntimeName, Shim: defaultV2ShimConfig(conf, defaultRuntimeName)} conf.Runtimes[config.LinuxV2RuntimeName] = types.Runtime{Path: defaultRuntimeName, Shim: defaultV2ShimConfig(conf, defaultRuntimeName)}
conf.Runtimes[config.StockRuntimeName] = conf.Runtimes[config.LinuxV2RuntimeName] conf.Runtimes[config.StockRuntimeName] = conf.Runtimes[config.LinuxV2RuntimeName]
} }
@ -52,17 +48,6 @@ func defaultV2ShimConfig(conf *config.Config, runtimePath string) *types.ShimCon
} }
} }
func defaultV1ShimConfig(conf *config.Config, runtimePath string) *types.ShimConfig {
return &types.ShimConfig{
Binary: linuxShimV1,
Opts: &runctypes.RuncOptions{
Runtime: runtimePath,
RuntimeRoot: filepath.Join(conf.ExecRoot, "runtime-"+defaultRuntimeName),
SystemdCgroup: UsingSystemd(conf),
},
}
}
func (daemon *Daemon) loadRuntimes() error { func (daemon *Daemon) loadRuntimes() error {
return daemon.initRuntimes(daemon.configStore.Runtimes) return daemon.initRuntimes(daemon.configStore.Runtimes)
} }
@ -147,12 +132,5 @@ func (daemon *Daemon) getRuntime(name string) (*types.Runtime, error) {
rt.Shim = defaultV2ShimConfig(daemon.configStore, rt.Path) rt.Shim = defaultV2ShimConfig(daemon.configStore, rt.Path)
} }
if rt.Shim.Binary == linuxShimV1 {
if cgroups.Mode() == cgroups.Unified {
return nil, errdefs.InvalidParameter(errors.Errorf("runtime %q is not supported while cgroups v2 (unified hierarchy) is being used", name))
}
logrus.Warnf("Configured runtime %q is deprecated and will be removed in the next release", name)
}
return rt, nil return rt, nil
} }