Skip to content

Commit f844746

Browse files
committed
Add warning for CRIU config usage
Signed-off-by: ruiwen-zhao <[email protected]> (cherry picked from commit 1fdefdd) Signed-off-by: ruiwen-zhao <[email protected]>
1 parent 3dd1e88 commit f844746

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

pkg/cri/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
396396
}
397397
log.G(ctx).Warning("`runtime_root` is deprecated, please use runtime `options` instead")
398398
}
399+
400+
if p, ok := r.Options["CriuPath"].(string); ok && p != "" {
401+
log.G(ctx).Warning("`CriuPath` is deprecated, please use a criu binary in $PATH instead.")
402+
warnings = append(warnings, deprecation.CRICRIUPath)
403+
}
399404
}
400405

401406
useConfigPath := c.Registry.ConfigPath != ""

pkg/cri/config/config_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,33 @@ func TestValidateConfig(t *testing.T) {
430430
},
431431
warnings: []deprecation.Warning{deprecation.CRIRegistryConfigs},
432432
},
433+
"deprecated CRIU path": {
434+
config: &PluginConfig{
435+
ContainerdConfig: ContainerdConfig{
436+
DefaultRuntimeName: RuntimeDefault,
437+
Runtimes: map[string]Runtime{
438+
RuntimeDefault: {
439+
Options: map[string]interface{}{
440+
"CriuPath": "/path/to/criu-binary",
441+
},
442+
},
443+
},
444+
},
445+
},
446+
expected: &PluginConfig{
447+
ContainerdConfig: ContainerdConfig{
448+
DefaultRuntimeName: RuntimeDefault,
449+
Runtimes: map[string]Runtime{
450+
RuntimeDefault: {
451+
Options: map[string]interface{}{
452+
"CriuPath": "/path/to/criu-binary",
453+
},
454+
},
455+
},
456+
},
457+
},
458+
warnings: []deprecation.Warning{deprecation.CRICRIUPath},
459+
},
433460
} {
434461
t.Run(desc, func(t *testing.T) {
435462
w, err := ValidatePluginConfig(context.Background(), test.config)

pkg/deprecation/deprecation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const (
3939
RuntimeV1 Warning = Prefix + "runtime-v1"
4040
// RuntimeRuncV1 is a warning for the io.containerd.runc.v1 runtime
4141
RuntimeRuncV1 Warning = Prefix + "runtime-runc-v1"
42+
// CRICRIUPath is a warning for the use of the `CriuPath` property
43+
CRICRIUPath Warning = Prefix + "cri-criu-path"
4244
)
4345

4446
var messages = map[Warning]string{
@@ -55,6 +57,8 @@ var messages = map[Warning]string{
5557
AUFSSnapshotter: "The aufs snapshotter is deprecated since containerd v1.5 and removed in containerd v2.0. Use the overlay snapshotter instead.",
5658
RuntimeV1: "The `io.containerd.runtime.v1.linux` runtime is deprecated since containerd v1.4 and removed in containerd v2.0. Use the `io.containerd.runc.v2` runtime instead.",
5759
RuntimeRuncV1: "The `io.containerd.runc.v1` runtime is deprecated since containerd v1.4 and removed in containerd v2.0. Use the `io.containerd.runc.v2` runtime instead.",
60+
CRICRIUPath: "The `CriuPath` property of `[plugins.\"io.containerd.grpc.v1.cri\".containerd.runtimes.*.options]` is deprecated since containerd v1.7 and will be removed in containerd v2.0. " +
61+
"Use a criu binary in $PATH instead.",
5862
}
5963

6064
// Valid checks whether a given Warning is valid

0 commit comments

Comments
 (0)