X Tutup
Skip to content

Commit aaccfcb

Browse files
committed
Fix containerd config dump.
Signed-off-by: Lantao Liu <lantaol@google.com>
1 parent 966b1b8 commit aaccfcb

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

cmd/containerd/command/config.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ func outputConfig(cfg *srvconfig.Config) error {
6565
}
6666
}
6767

68+
if config.Timeouts == nil {
69+
config.Timeouts = make(map[string]string)
70+
}
6871
timeouts := timeout.All()
69-
config.Timeouts = make(map[string]string)
7072
for k, v := range timeouts {
71-
config.Timeouts[k] = v.String()
73+
if config.Timeouts[k] == "" {
74+
config.Timeouts[k] = v.String()
75+
}
7276
}
7377

7478
// for the time being, keep the defaultConfig's version set at 1 so that

docs/man/containerd-config.toml.5.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ separately (for example vendors may keep a custom runtime configuration in a
3939
separate file without modifying the main `config.toml`).
4040
Imported files will overwrite simple fields like `int` or
4141
`string` (if not empty) and will append `array` and `map` fields.
42+
Imported files are also versioned, and the version can't be higher than
43+
the main config.
4244

4345
**[grpc]**
4446
: Section for gRPC socket listener settings. Contains three properties:

services/server/config/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import (
2828
"github.com/containerd/containerd/plugin"
2929
)
3030

31+
// NOTE: Any new map fields added also need to be handled in mergeConfig.
32+
3133
// Config provides containerd configuration data for the server
3234
type Config struct {
3335
// Version of the config file
@@ -321,6 +323,10 @@ func mergeConfig(to, from *Config) error {
321323
to.ProxyPlugins[k] = v
322324
}
323325

326+
for k, v := range from.Timeouts {
327+
to.Timeouts[k] = v
328+
}
329+
324330
return nil
325331
}
326332

0 commit comments

Comments
 (0)
X Tutup