Skip to content

Commit eb9925d

Browse files
committed
Update config migrations to decode using the plugin type
Ensure migration picks up defaults and correct ordering from the plugin configuration. Ensures that the migration matches the behavior of the default output and how the configuration will be loaded. Signed-off-by: Derek McGowan <[email protected]>
1 parent 1571301 commit eb9925d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

cmd/containerd/command/config.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,28 @@ var configCommand = cli.Command{
123123
}
124124
}
125125

126+
plugins, err := server.LoadPlugins(ctx, config)
127+
if err != nil {
128+
return err
129+
}
130+
if len(plugins) != 0 {
131+
if config.Plugins == nil {
132+
config.Plugins = make(map[string]interface{})
133+
}
134+
for _, p := range plugins {
135+
if p.Config == nil {
136+
continue
137+
}
138+
139+
pc, err := config.Decode(ctx, p.URI(), p.Config)
140+
if err != nil {
141+
return err
142+
}
143+
144+
config.Plugins[p.URI()] = pc
145+
}
146+
}
147+
126148
config.Version = srvconfig.CurrentConfigVersion
127149

128150
return toml.NewEncoder(os.Stdout).SetIndentTables(true).Encode(config)

0 commit comments

Comments
 (0)