diff --git a/pkg/config/config.go b/pkg/config/config.go index 446fff5ba31..870a838809e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -452,11 +452,17 @@ func (c *Config) UpdateFromFile(path string) error { t := new(tomlConfig) t.fromConfig(c) - _, err = toml.Decode(string(data), t) + metadata, err := toml.Decode(string(data), t) if err != nil { return fmt.Errorf("unable to decode configuration %v: %v", path, err) } + runtimesKey := []string{"crio", "runtime", "default_runtime"} + if metadata.IsDefined(runtimesKey...) && + t.Crio.Runtime.RuntimeConfig.DefaultRuntime != defaultRuntime { + delete(c.Runtimes, defaultRuntime) + } + t.toConfig(c) c.singleConfigPath = path return nil diff --git a/pkg/config/template.go b/pkg/config/template.go index c42f42f64d1..34abe6aace8 100644 --- a/pkg/config/template.go +++ b/pkg/config/template.go @@ -110,7 +110,8 @@ grpc_max_recv_msg_size = {{ .GRPCMaxRecvMsgSize }} {{ range $ulimit := .DefaultUlimits }}{{ printf "#\t%q,\n" $ulimit }}{{ end }}#] # default_runtime is the _name_ of the OCI runtime to be used as the default. -# The name is matched against the runtimes map below. +# The name is matched against the runtimes map below. If this value is changed, +# the corresponding existing entry from the runtimes map below will be ignored. default_runtime = "{{ .DefaultRuntime }}" # If true, the runtime will not use pivot_root, but instead use MS_MOVE.