Change CRI config runtime options type

Changing Runtime.Options type to map[string]interface{}
to correctly marshal it from go to JSON.
See issue: https://github.com/kubernetes-sigs/cri-tools/issues/728

Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
This commit is contained in:
Aditi Sharma
2021-04-06 14:01:15 +05:30
parent 1edab60723
commit 4d4117415e
2 changed files with 11 additions and 5 deletions

View File

@@ -23,7 +23,6 @@ import (
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/plugin"
"github.com/pelletier/go-toml"
"github.com/pkg/errors"
)
@@ -47,9 +46,11 @@ type Runtime struct {
// DEPRECATED: use Options instead. Remove when shim v1 is deprecated.
// This only works for runtime type "io.containerd.runtime.v1.linux".
Root string `toml:"runtime_root" json:"runtimeRoot"`
// Options are config options for the runtime. If options is loaded
// from toml config, it will be toml.Tree.
Options *toml.Tree `toml:"options" json:"options"`
// Options are config options for the runtime.
// If options is loaded from toml config, it will be map[string]interface{}.
// Options can be converted into toml.Tree using toml.TreeFromMap().
// Using options type as map[string]interface{} helps in correctly marshaling options from Go to JSON.
Options map[string]interface{} `toml:"options" json:"options"`
// PrivilegedWithoutHostDevices overloads the default behaviour for adding host devices to the
// runtime spec when the container is privileged. Defaults to false.
PrivilegedWithoutHostDevices bool `toml:"privileged_without_host_devices" json:"privileged_without_host_devices"`