Fix backword-compatibility issue of non-versioned config file

According to the doc about `config.toml` of containerd:

```
If no version number is specified inside the config file then it is assumed to
be a version 1 config and parsed as such.
```

However, it's not true recently.
This will break the backward-compatibility in some environment.
This commit fixes this issue.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
ktock
2021-04-14 17:22:36 +09:00
parent 5c6ea7fdc1
commit fdb76f55d8
3 changed files with 32 additions and 1 deletions

View File

@@ -120,7 +120,11 @@ var configCommand = cli.Command{
func platformAgnosticDefaultConfig() *srvconfig.Config {
return &srvconfig.Config{
Version: 2,
// see: https://github.com/containerd/containerd/blob/5c6ea7fdc1247939edaddb1eba62a94527418687/RELEASES.md#daemon-configuration
// this version MUST remain set to 1 until either there exists a means to
// override / configure the default at the containerd cli .. or when
// version 1 is no longer supported
Version: 1,
Root: defaults.DefaultRootDir,
State: defaults.DefaultStateDir,
GRPC: srvconfig.GRPCConfig{