Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/1.7] Add warning for CRIU config usage #9481

Merged
merged 1 commit into from Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/cri/config/config.go
Expand Up @@ -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 != ""
Expand Down
29 changes: 29 additions & 0 deletions pkg/cri/config/config_test.go
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions pkg/deprecation/deprecation.go
Expand Up @@ -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{
Expand All @@ -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
Expand Down