Skip to content

Commit

Permalink
Add check for unsupported config versions
Browse files Browse the repository at this point in the history
Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit 00347b7)
Signed-off-by: Derek McGowan <derek@mcg.dev>
  • Loading branch information
dmcgowan committed May 15, 2024
1 parent 214c164 commit 38607b5
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 38607b5

Please sign in to comment.