Skip to content

Commit

Permalink
CRI: Mirror generic toml runtime config under server
Browse files Browse the repository at this point in the history
In containerd#7764 it was made
so that generic runtime options in the containerd toml config file
would get passed to shims regardless of if containerd knew of the
type beforehand and could supply the struct. However, this was only
added for the sandbox server fork here and not the regular ol' CRI
server. This change just mirrors the parts that need to be plopped in
pkg/cri/server

Signed-off-by: Danny Canter <danny@dcantah.dev>
  • Loading branch information
dcantah committed Feb 11, 2023
1 parent cf7b705 commit 74b371b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/cri/server/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,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
}

Expand Down

0 comments on commit 74b371b

Please sign in to comment.