Skip to content

Commit

Permalink
Merge pull request containerd#10234 from dmcgowan/1.6-handle-unsuppor…
Browse files Browse the repository at this point in the history
…ted-config-version

[release/1.6] Handle unsupported config versions
  • Loading branch information
samuelkarp authored May 15, 2024
2 parents 214c164 + 38607b5 commit 12a9278
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions services/server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,16 @@ func (c *Config) GetVersion() int {
func (c *Config) ValidateV2() error {
version := c.GetVersion()
if version < 2 {
logrus.Warnf("containerd config version `%d` has been deprecated and will be removed in containerd v2.0, please switch to version `2`, "+
"see https://github.com/containerd/containerd/blob/main/docs/PLUGINS.md#version-header", version)
logrus.Warnf("containerd config version `%d` has been deprecated and will be converted on each startup in containerd v2.0, "+
"use `containerd config migrate` after upgrading to containerd 2.0 to avoid conversion on startup", version)
return nil
}
if version > 2 {
logrus.Errorf("containerd config version `%d` is not supported, the max version is `2`, "+
"use `containerd config default` to generate a new config or manually revert to version `2`", version)
return fmt.Errorf("unsupported config version `%d`", version)

}
for _, p := range c.DisabledPlugins {
if len(strings.Split(p, ".")) < 4 {
return fmt.Errorf("invalid disabled plugin URI %q expect io.containerd.x.vx", p)
Expand Down

0 comments on commit 12a9278

Please sign in to comment.