mirror of
https://github.com/containerd/containerd.git
synced 2026-08-13 17:07:26 +00:00
Add warning for CRIU config usage
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
This commit is contained in:
@@ -491,6 +491,11 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
|
||||
r.SandboxMode = string(ModePodSandbox)
|
||||
c.ContainerdConfig.Runtimes[k] = r
|
||||
}
|
||||
|
||||
if p, ok := r.Options["CriuPath"].(string); ok && p != "" {
|
||||
log.G(ctx).Warning("`CriuPath` is deprecated, please use a criu binary in $PATH instead.")
|
||||
warnings = append(warnings, deprecation.CRICRIUPath)
|
||||
}
|
||||
}
|
||||
|
||||
useConfigPath := c.Registry.ConfigPath != ""
|
||||
|
||||
@@ -477,6 +477,35 @@ func TestValidateConfig(t *testing.T) {
|
||||
},
|
||||
expectedErr: "invalid `drain_exec_sync_io_timeout`",
|
||||
},
|
||||
"deprecated CRIU path": {
|
||||
config: &PluginConfig{
|
||||
ContainerdConfig: ContainerdConfig{
|
||||
DefaultRuntimeName: RuntimeDefault,
|
||||
Runtimes: map[string]Runtime{
|
||||
RuntimeDefault: {
|
||||
SandboxMode: string(ModePodSandbox),
|
||||
Options: map[string]interface{}{
|
||||
"CriuPath": "/path/to/criu-binary",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: &PluginConfig{
|
||||
ContainerdConfig: ContainerdConfig{
|
||||
DefaultRuntimeName: RuntimeDefault,
|
||||
Runtimes: map[string]Runtime{
|
||||
RuntimeDefault: {
|
||||
SandboxMode: string(ModePodSandbox),
|
||||
Options: map[string]interface{}{
|
||||
"CriuPath": "/path/to/criu-binary",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
warnings: []deprecation.Warning{deprecation.CRICRIUPath},
|
||||
},
|
||||
} {
|
||||
t.Run(desc, func(t *testing.T) {
|
||||
w, err := ValidatePluginConfig(context.Background(), test.config)
|
||||
|
||||
@@ -49,6 +49,8 @@ const (
|
||||
RuntimeV1 Warning = Prefix + "runtime-v1"
|
||||
// RuntimeRuncV1 is a warning for the io.containerd.runc.v1 runtime
|
||||
RuntimeRuncV1 Warning = Prefix + "runtime-runc-v1"
|
||||
// CRICRIUPath is a warning for the use of the `CriuPath` property
|
||||
CRICRIUPath Warning = Prefix + "cri-criu-path"
|
||||
)
|
||||
|
||||
var messages = map[Warning]string{
|
||||
@@ -75,6 +77,8 @@ var messages = map[Warning]string{
|
||||
AUFSSnapshotter: "The aufs snapshotter is deprecated since containerd v1.5 and removed in containerd v2.0. Use the overlay snapshotter instead.",
|
||||
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.",
|
||||
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.",
|
||||
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. " +
|
||||
"Use a criu binary in $PATH instead.",
|
||||
}
|
||||
|
||||
// Valid checks whether a given Warning is valid
|
||||
|
||||
Reference in New Issue
Block a user