Merge pull request #7764 from mxpv/config

Pass TOML configuration options for runtimes CRI is not aware of
This commit is contained in:
Maksym Pavlenko
2022-12-08 12:59:13 -08:00
committed by GitHub
5 changed files with 91 additions and 40 deletions

View File

@@ -348,6 +348,16 @@ func generateRuntimeOptions(r criconfig.Runtime, c criconfig.Config) (interface{
if err := optionsTree.Unmarshal(options); err != nil {
return nil, err
}
// 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 == "" {
runtimeOpts.ConfigBody, err = optionsTree.Marshal()
if err != nil {
return nil, fmt.Errorf("failed to marshal TOML blob for runtime %q: %v", r.Type, err)
}
}
return options, nil
}