Skip to content

Commit 1fdefdd

Browse files
committed
Add warning for CRIU config usage
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
1 parent 689d07b commit 1fdefdd

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

pkg/cri/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
491491
r.SandboxMode = string(ModePodSandbox)
492492
c.ContainerdConfig.Runtimes[k] = r
493493
}
494+
495+
if p, ok := r.Options["CriuPath"].(string); ok && p != "" {
496+
log.G(ctx).Warning("`CriuPath` is deprecated, please use a criu binary in $PATH instead.")
497+
warnings = append(warnings, deprecation.CRICRIUPath)
498+
}
494499
}
495500

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

pkg/cri/config/config_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,35 @@ func TestValidateConfig(t *testing.T) {
477477
},
478478
expectedErr: "invalid `drain_exec_sync_io_timeout`",
479479
},
480+
"deprecated CRIU path": {
481+
config: &PluginConfig{
482+
ContainerdConfig: ContainerdConfig{
483+
DefaultRuntimeName: RuntimeDefault,
484+
Runtimes: map[string]Runtime{
485+
RuntimeDefault: {
486+
SandboxMode: string(ModePodSandbox),
487+
Options: map[string]interface{}{
488+
"CriuPath": "/path/to/criu-binary",
489+
},
490+
},
491+
},
492+
},
493+
},
494+
expected: &PluginConfig{
495+
ContainerdConfig: ContainerdConfig{
496+
DefaultRuntimeName: RuntimeDefault,
497+
Runtimes: map[string]Runtime{
498+
RuntimeDefault: {
499+
SandboxMode: string(ModePodSandbox),
500+
Options: map[string]interface{}{
501+
"CriuPath": "/path/to/criu-binary",
502+
},
503+
},
504+
},
505+
},
506+
},
507+
warnings: []deprecation.Warning{deprecation.CRICRIUPath},
508+
},
480509
} {
481510
t.Run(desc, func(t *testing.T) {
482511
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
@@ -49,6 +49,8 @@ const (
4949
RuntimeV1 Warning = Prefix + "runtime-v1"
5050
// RuntimeRuncV1 is a warning for the io.containerd.runc.v1 runtime
5151
RuntimeRuncV1 Warning = Prefix + "runtime-runc-v1"
52+
// CRICRIUPath is a warning for the use of the `CriuPath` property
53+
CRICRIUPath Warning = Prefix + "cri-criu-path"
5254
)
5355

5456
var messages = map[Warning]string{
@@ -75,6 +77,8 @@ var messages = map[Warning]string{
7577
AUFSSnapshotter: "The aufs snapshotter is deprecated since containerd v1.5 and removed in containerd v2.0. Use the overlay snapshotter instead.",
7678
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.",
7779
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.",
80+
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. " +
81+
"Use a criu binary in $PATH instead.",
7882
}
7983

8084
// Valid checks whether a given Warning is valid

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy