Print warning message for deprecated options.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-08-02 01:07:22 -07:00
parent f636fb0519
commit b74653b821
6 changed files with 38 additions and 28 deletions

View File

@@ -27,6 +27,7 @@ import (
"github.com/BurntSushi/toml"
"github.com/containerd/containerd"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/runtime/linux/runctypes"
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/containerd/typeurl"
@@ -116,16 +117,6 @@ const (
networkAttachCount = 2
)
// Runtime type strings for various runtimes.
const (
// linuxRuntime is the legacy linux runtime for shim v1.
linuxRuntime = "io.containerd.runtime.v1.linux"
// runcRuntimeV1 is the runc v1 runtime for shim v2.
runcRuntimeV1 = "io.containerd.runc.v1"
// runcRuntimeV2 is the runc v2 runtime for shim v2.
runcRuntimeV2 = "io.containerd.runc.v2"
)
// makeSandboxName generates sandbox name from sandbox metadata. The name
// generated is unique as long as sandbox metadata is unique.
func makeSandboxName(s *runtime.PodSandboxMetadata) string {
@@ -416,7 +407,7 @@ func parseImageReferences(refs []string) ([]string, []string) {
// generateRuntimeOptions generates runtime options from cri plugin config.
func generateRuntimeOptions(r criconfig.Runtime, c criconfig.Config) (interface{}, error) {
if r.Options == nil {
if r.Type != linuxRuntime {
if r.Type != plugin.RuntimeLinuxV1 {
return nil, nil
}
// This is a legacy config, generate runctypes.RuncOptions.
@@ -436,11 +427,11 @@ func generateRuntimeOptions(r criconfig.Runtime, c criconfig.Config) (interface{
// getRuntimeOptionsType gets empty runtime options by the runtime type name.
func getRuntimeOptionsType(t string) interface{} {
switch t {
case runcRuntimeV1:
case plugin.RuntimeRuncV1:
fallthrough
case runcRuntimeV2:
case plugin.RuntimeRuncV2:
return &runcoptions.Options{}
case linuxRuntime:
case plugin.RuntimeLinuxV1:
return &runctypes.RuncOptions{}
default:
return &runtimeoptions.Options{}