diff --git a/pkg/cri/server/helpers.go b/pkg/cri/server/helpers.go index 2b42538d4a75..dd82caad1185 100644 --- a/pkg/cri/server/helpers.go +++ b/pkg/cri/server/helpers.go @@ -18,6 +18,7 @@ package server import ( "context" + "encoding/json" "fmt" "path" "path/filepath" @@ -348,6 +349,16 @@ func generateRuntimeOptions(r criconfig.Runtime) (interface{}, error) { // For generic configuration, if no config path specified (preserving old behavior), pass // the whole TOML configuration section to the runtime. if runtimeOpts, ok := options.(*runtimeoptions.Options); ok && runtimeOpts.ConfigPath == "" { + + if runtimeOpts.TypeUrl != "" { + body, err := json.Marshal(r.Options) + if err != nil { + return nil, fmt.Errorf("failed to marshal config body as JSON for runtime %q: %v", r.Type, err) + } + runtimeOpts.ConfigBody = body + return options, nil + } + runtimeOpts.ConfigBody, err = optionsTree.Marshal() if err != nil { return nil, fmt.Errorf("failed to marshal TOML blob for runtime %q: %v", r.Type, err)