Skip to content

Commit de0cc92

Browse files
samuelkarpruiwen-zhao
authored andcommitted
cri: add deprecation warning for runtime_root
Signed-off-by: Samuel Karp <[email protected]> (cherry picked from commit 51a604c) Signed-off-by: ruiwen-zhao <[email protected]>
1 parent 833b941 commit de0cc92

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
@@ -398,6 +398,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
398398
if r.Type != plugin.RuntimeLinuxV1 {
399399
return warnings, fmt.Errorf("`runtime_root` only works for runtime %s", plugin.RuntimeLinuxV1)
400400
}
401+
warnings = append(warnings, deprecation.CRIRuntimeRoot)
401402
log.G(ctx).Warning("`runtime_root` is deprecated, please use runtime `options` instead")
402403
}
403404
}

pkg/cri/config/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ func TestValidateConfig(t *testing.T) {
259259
},
260260
},
261261
},
262+
warnings: []deprecation.Warning{deprecation.CRIRuntimeRoot},
262263
},
263264
"deprecated runtime_root for v2 runtime": {
264265
config: &PluginConfig{

pkg/deprecation/deprecation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const (
3333
CRIDefaultRuntime Warning = Prefix + "cri-default-runtime"
3434
// CRIRuntimeEngine is a warning for the `runtime_engine` property
3535
CRIRuntimeEngine Warning = Prefix + "cri-runtime-engine"
36+
// CRIRuntimeRoot is a warning for the `runtime_root` property
37+
CRIRuntimeRoot Warning = Prefix + "cri-runtime-root"
3638
// CRIRegistryMirrors is a warning for the use of the `mirrors` property
3739
CRIRegistryMirrors Warning = Prefix + "cri-registry-mirrors"
3840
// CRIRegistryAuths is a warning for the use of the `auths` property
@@ -61,6 +63,8 @@ var messages = map[Warning]string{
6163
"Use `default_runtime_name` instead.",
6264
CRIRuntimeEngine: "The `runtime_engine` property of [plugins.\"io.containerd.grpc.v1.cri\".containerd.runtimes.*] is deprecated since containerd v1.3 and will be removed in containerd v2.0. " +
6365
"Use a v2 runtime and `options` instead.",
66+
CRIRuntimeRoot: "The `runtime_root` property of [plugins.\"io.containerd.grpc.v1.cri\".containerd.runtimes.*] is deprecated since containerd v1.3 and will be removed in containerd v2.0. " +
67+
"Use a v2 runtime and `options.Root` instead.",
6468
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." +
6569
"Use `config_path` instead.",
6670
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)