Skip to content

Commit 47de3d6

Browse files
samuelkarpruiwen-zhao
authored andcommitted
cri: add deprecation warning for default_runtime
Signed-off-by: Samuel Karp <[email protected]> (cherry picked from commit 99adc40) Signed-off-by: ruiwen-zhao <[email protected]>
1 parent d421b8f commit 47de3d6

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

pkg/cri/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
357357

358358
// Validation for deprecated default_runtime field.
359359
if c.ContainerdConfig.DefaultRuntime.Type != "" {
360+
warnings = append(warnings, deprecation.CRIDefaultRuntime)
360361
log.G(ctx).Warning("`default_runtime` is deprecated, please use `default_runtime_name` to reference the default configuration you have defined in `runtimes`")
361362
c.ContainerdConfig.DefaultRuntimeName = RuntimeDefault
362363
c.ContainerdConfig.Runtimes[RuntimeDefault] = c.ContainerdConfig.DefaultRuntime

pkg/cri/config/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func TestValidateConfig(t *testing.T) {
106106
},
107107
},
108108
},
109+
warnings: []deprecation.Warning{deprecation.CRIDefaultRuntime},
109110
},
110111
"no default_runtime_name": {
111112
config: &PluginConfig{},

pkg/deprecation/deprecation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const (
2929
CRISystemdCgroupV1 Warning = Prefix + "cri-systemd-cgroup-v1"
3030
// CRIUntrustedWorkloadRuntime is a warning for the `untrusted_workload_runtime` property
3131
CRIUntrustedWorkloadRuntime Warning = Prefix + "cri-untrusted-workload-runtime"
32+
// CRIDefaultRuntime is a warning for the `default_runtime` property
33+
CRIDefaultRuntime Warning = Prefix + "cri-default-runtime"
3234
// CRIRegistryMirrors is a warning for the use of the `mirrors` property
3335
CRIRegistryMirrors Warning = Prefix + "cri-registry-mirrors"
3436
// CRIRegistryAuths is a warning for the use of the `auths` property
@@ -53,6 +55,8 @@ var messages = map[Warning]string{
5355
"Use `SystemdCgroup` in [plugins.\"io.containerd.grpc.v1.cri\".containerd.runtimes.runc.options] options instead.",
5456
CRIUntrustedWorkloadRuntime: "The `untrusted_workload_runtime` property of [plugins.\"io.containerd.grpc.v1.cri\".containerd] is deprecated since containerd v1.2 and will be removed in containerd v2.0. " +
5557
"Create an `untrusted` runtime in `runtimes` instead.",
58+
CRIDefaultRuntime: "The `default_runtime` property of [plugins.\"io.containerd.grpc.v1.cri\".containerd] is deprecated since containerd v1.3 and will be removed in containerd v2.0. " +
59+
"Use `default_runtime_name` instead.",
5660
CRIRegistryMirrors: "The `mirrors` property of `[plugins.\"io.containerd.grpc.v1.cri\".registry]` is deprecated since containerd v1.5 and will be removed in containerd v2.0." +
5761
"Use `config_path` instead.",
5862
CRIRegistryAuths: "The `auths` property of `[plugins.\"io.containerd.grpc.v1.cri\".registry]` is deprecated since containerd v1.3 and will be removed in containerd v2.0." +

0 commit comments

Comments
 (0)