Skip to content

Commit

Permalink
Merge pull request #9481 from ruiwen-zhao/cri-u
Browse files Browse the repository at this point in the history
[release/1.7] Add warning for CRIU config usage
  • Loading branch information
samuelkarp committed Dec 7, 2023
2 parents d94f8ff + 1fdefdd commit 467de56
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
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

0 comments on commit 467de56

Please sign in to comment.