Skip to content

Commit

Permalink
Merge pull request #3337 from crosbymichael/config-bk
Browse files Browse the repository at this point in the history
Fix backwards compat with v2 containerd configs
  • Loading branch information
estesp committed Jun 12, 2019
2 parents 53896d7 + 31afff2 commit 545e79a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Expand Up @@ -74,11 +74,6 @@ script:
- go build -i .
- make check
- if [ "$GOOS" = "linux" ]; then make check-protos check-api-descriptors; fi
- |
sudo mkdir -p /etc/containerd
sudo bash -c "cat > /etc/containerd/config.toml <<EOF
version = 1
EOF"
- make build
- make binaries
- if [ "$TRAVIS_GOOS" = "linux" ]; then sudo make install ; fi
Expand All @@ -91,7 +86,6 @@ script:
if [ "$TRAVIS_GOOS" = "linux" ]; then
sudo mkdir -p /etc/containerd
sudo bash -c "cat > /etc/containerd/config.toml <<EOF
version = 1
[plugins.cri.containerd.default_runtime]
runtime_type = \"${TEST_RUNTIME}\"
EOF"
Expand Down
5 changes: 5 additions & 0 deletions cmd/containerd/command/config.go
Expand Up @@ -50,6 +50,11 @@ var configCommand = cli.Command{
config := &Config{
Config: defaultConfig(),
}
// for the time being, keep the defaultConfig's version set at 1 so that
// when a config without a version is loaded from disk and has no version
// set, we assume it's a v1 config. But when generating new configs via
// this command, generate the v2 config
config.Config.Version = 2
plugins, err := server.LoadPlugins(gocontext.Background(), config.Config)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/containerd/command/config_linux.go
Expand Up @@ -23,7 +23,7 @@ import (

func defaultConfig() *srvconfig.Config {
return &srvconfig.Config{
Version: 2,
Version: 1,
Root: defaults.DefaultRootDir,
State: defaults.DefaultStateDir,
GRPC: srvconfig.GRPCConfig{
Expand Down
2 changes: 1 addition & 1 deletion cmd/containerd/command/config_unsupported.go
Expand Up @@ -25,7 +25,7 @@ import (

func defaultConfig() *srvconfig.Config {
return &srvconfig.Config{
Version: 2,
Version: 1,
Root: defaults.DefaultRootDir,
State: defaults.DefaultStateDir,
GRPC: srvconfig.GRPCConfig{
Expand Down
2 changes: 1 addition & 1 deletion cmd/containerd/command/config_windows.go
Expand Up @@ -23,7 +23,7 @@ import (

func defaultConfig() *srvconfig.Config {
return &srvconfig.Config{
Version: 2,
Version: 1,
Root: defaults.DefaultRootDir,
State: defaults.DefaultStateDir,
GRPC: srvconfig.GRPCConfig{
Expand Down

0 comments on commit 545e79a

Please sign in to comment.