File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,7 +120,11 @@ var configCommand = cli.Command{
120120
121121func platformAgnosticDefaultConfig () * srvconfig.Config {
122122 return & srvconfig.Config {
123- Version : 2 ,
123+ // see: https://github.com/containerd/containerd/blob/5c6ea7fdc1247939edaddb1eba62a94527418687/RELEASES.md#daemon-configuration
124+ // this version MUST remain set to 1 until either there exists a means to
125+ // override / configure the default at the containerd cli .. or when
126+ // version 1 is no longer supported
127+ Version : 1 ,
124128 Root : defaults .DefaultRootDir ,
125129 State : defaults .DefaultStateDir ,
126130 GRPC : srvconfig.GRPCConfig {
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ func (c *Config) ValidateV2() error {
9898 version := c .GetVersion ()
9999 if version < 2 {
100100 logrus .Warnf ("deprecated version : `%d`, please switch to version `2`" , version )
101+ return nil
101102 }
102103 for _ , p := range c .DisabledPlugins {
103104 if len (strings .Split (p , "." )) < 4 {
Original file line number Diff line number Diff line change @@ -207,3 +207,29 @@ version = 2
207207 assert .NilError (t , err )
208208 assert .Equal (t , true , pluginConfig ["shim_debug" ])
209209}
210+
211+ // TestDecodePluginInV1Config tests decoding non-versioned
212+ // config (should be parsed as V1 config).
213+ func TestDecodePluginInV1Config (t * testing.T ) {
214+ data := `
215+ [plugins.linux]
216+ shim_debug = true
217+ `
218+
219+ tempDir , err := ioutil .TempDir ("" , "containerd_" )
220+ assert .NilError (t , err )
221+ defer os .RemoveAll (tempDir )
222+
223+ path := filepath .Join (tempDir , "config.toml" )
224+ err = ioutil .WriteFile (path , []byte (data ), 0600 )
225+ assert .NilError (t , err )
226+
227+ var out Config
228+ err = LoadConfig (path , & out )
229+ assert .NilError (t , err )
230+
231+ pluginConfig := map [string ]interface {}{}
232+ _ , err = out .Decode (& plugin.Registration {ID : "linux" , Config : & pluginConfig })
233+ assert .NilError (t , err )
234+ assert .Equal (t , true , pluginConfig ["shim_debug" ])
235+ }
You can’t perform that action at this time.
0 commit comments