Merge pull request #3337 from crosbymichael/config-bk

Fix backwards compat with v2 containerd configs
This commit is contained in:
Phil Estes 2019-06-11 21:08:15 -04:00 committed by GitHub
commit 545e79ae11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 9 deletions

View File

@ -74,11 +74,6 @@ script:
- go build -i . - go build -i .
- make check - make check
- if [ "$GOOS" = "linux" ]; then make check-protos check-api-descriptors; fi - 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 build
- make binaries - make binaries
- if [ "$TRAVIS_GOOS" = "linux" ]; then sudo make install ; fi - if [ "$TRAVIS_GOOS" = "linux" ]; then sudo make install ; fi
@ -91,7 +86,6 @@ script:
if [ "$TRAVIS_GOOS" = "linux" ]; then if [ "$TRAVIS_GOOS" = "linux" ]; then
sudo mkdir -p /etc/containerd sudo mkdir -p /etc/containerd
sudo bash -c "cat > /etc/containerd/config.toml <<EOF sudo bash -c "cat > /etc/containerd/config.toml <<EOF
version = 1
[plugins.cri.containerd.default_runtime] [plugins.cri.containerd.default_runtime]
runtime_type = \"${TEST_RUNTIME}\" runtime_type = \"${TEST_RUNTIME}\"
EOF" EOF"

View File

@ -50,6 +50,11 @@ var configCommand = cli.Command{
config := &Config{ config := &Config{
Config: defaultConfig(), 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) plugins, err := server.LoadPlugins(gocontext.Background(), config.Config)
if err != nil { if err != nil {
return err return err

View File

@ -23,7 +23,7 @@ import (
func defaultConfig() *srvconfig.Config { func defaultConfig() *srvconfig.Config {
return &srvconfig.Config{ return &srvconfig.Config{
Version: 2, Version: 1,
Root: defaults.DefaultRootDir, Root: defaults.DefaultRootDir,
State: defaults.DefaultStateDir, State: defaults.DefaultStateDir,
GRPC: srvconfig.GRPCConfig{ GRPC: srvconfig.GRPCConfig{

View File

@ -25,7 +25,7 @@ import (
func defaultConfig() *srvconfig.Config { func defaultConfig() *srvconfig.Config {
return &srvconfig.Config{ return &srvconfig.Config{
Version: 2, Version: 1,
Root: defaults.DefaultRootDir, Root: defaults.DefaultRootDir,
State: defaults.DefaultStateDir, State: defaults.DefaultStateDir,
GRPC: srvconfig.GRPCConfig{ GRPC: srvconfig.GRPCConfig{

View File

@ -23,7 +23,7 @@ import (
func defaultConfig() *srvconfig.Config { func defaultConfig() *srvconfig.Config {
return &srvconfig.Config{ return &srvconfig.Config{
Version: 2, Version: 1,
Root: defaults.DefaultRootDir, Root: defaults.DefaultRootDir,
State: defaults.DefaultStateDir, State: defaults.DefaultStateDir,
GRPC: srvconfig.GRPCConfig{ GRPC: srvconfig.GRPCConfig{