Skip to content

Commit

Permalink
Fix containerd config dump.
Browse files Browse the repository at this point in the history
Signed-off-by: Lantao Liu <lantaol@google.com>
  • Loading branch information
Random-Liu committed Oct 24, 2019
1 parent 966b1b8 commit aaccfcb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/containerd/command/config.go
Expand Up @@ -65,10 +65,14 @@ func outputConfig(cfg *srvconfig.Config) error {
}
}

if config.Timeouts == nil {
config.Timeouts = make(map[string]string)
}
timeouts := timeout.All()
config.Timeouts = make(map[string]string)
for k, v := range timeouts {
config.Timeouts[k] = v.String()
if config.Timeouts[k] == "" {
config.Timeouts[k] = v.String()
}
}

// for the time being, keep the defaultConfig's version set at 1 so that
Expand Down
2 changes: 2 additions & 0 deletions docs/man/containerd-config.toml.5.md
Expand Up @@ -39,6 +39,8 @@ separately (for example vendors may keep a custom runtime configuration in a
separate file without modifying the main `config.toml`).
Imported files will overwrite simple fields like `int` or
`string` (if not empty) and will append `array` and `map` fields.
Imported files are also versioned, and the version can't be higher than
the main config.

**[grpc]**
: Section for gRPC socket listener settings. Contains three properties:
Expand Down
6 changes: 6 additions & 0 deletions services/server/config/config.go
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/containerd/containerd/plugin"
)

// NOTE: Any new map fields added also need to be handled in mergeConfig.

// Config provides containerd configuration data for the server
type Config struct {
// Version of the config file
Expand Down Expand Up @@ -321,6 +323,10 @@ func mergeConfig(to, from *Config) error {
to.ProxyPlugins[k] = v
}

for k, v := range from.Timeouts {
to.Timeouts[k] = v
}

return nil
}

Expand Down

0 comments on commit aaccfcb

Please sign in to comment.