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:
@@ -32,6 +32,7 @@ import (
|
||||
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
|
||||
"github.com/containerd/typeurl"
|
||||
imagedigest "github.com/opencontainers/go-digest"
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||
@@ -308,8 +309,12 @@ func generateRuntimeOptions(r criconfig.Runtime, c criconfig.Config) (interface{
|
||||
SystemdCgroup: c.SystemdCgroup,
|
||||
}, nil
|
||||
}
|
||||
optionsTree, err := toml.TreeFromMap(r.Options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
options := getRuntimeOptionsType(r.Type)
|
||||
if err := r.Options.Unmarshal(options); err != nil {
|
||||
if err := optionsTree.Unmarshal(options); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return options, nil
|
||||
|
||||
Reference in New Issue
Block a user