Skip to content

Commit

Permalink
tasks: emit warning for runc v1 runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Karp <samuelkarp@google.com>
  • Loading branch information
samuelkarp committed Dec 1, 2023
1 parent 329e1d4 commit f471bb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pkg/deprecation/deprecation.go
Expand Up @@ -37,6 +37,8 @@ const (
AUFSSnapshotter Warning = Prefix + "aufs-snapshotter"
// RuntimeV1 is a warning for the io.containerd.runtime.v1.linux runtime
RuntimeV1 Warning = Prefix + "runtime-v1"
// RuntimeRuncV1 is a warning for the io.containerd.runc.v1 runtime
RuntimeRuncV1 Warning = Prefix + "runtime-runc-v1"
)

var messages = map[Warning]string{
Expand All @@ -52,6 +54,7 @@ var messages = map[Warning]string{
CRIAPIV1Alpha2: "CRI API v1alpha2 is deprecated since containerd v1.7 and removed in containerd v2.0. Use CRI API v1 instead.",
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.",
}

// Valid checks whether a given Warning is valid
Expand Down
6 changes: 3 additions & 3 deletions services/tasks/local.go
Expand Up @@ -231,9 +231,6 @@ func (l *local) Create(ctx context.Context, r *api.CreateTaskRequest, _ ...grpc.
Options: m.Options,
})
}
if container.Runtime.Name == plugin.RuntimeRuncV1 {
log.G(ctx).Warnf("%q is deprecated since containerd v1.4, consider using %q", plugin.RuntimeRuncV1, plugin.RuntimeRuncV2)
}
l.emitRuntimeWarning(ctx, container.Runtime.Name)
rtime, err := l.getRuntime(container.Runtime.Name)
if err != nil {
Expand Down Expand Up @@ -269,6 +266,9 @@ func (l *local) emitRuntimeWarning(ctx context.Context, runtime string) {
case plugin.RuntimeLinuxV1:
log.G(ctx).Warnf("%q is deprecated since containerd v1.4 and will be removed in containerd v2.0, use %q instead", plugin.RuntimeLinuxV1, plugin.RuntimeRuncV2)
l.warnings.Emit(ctx, deprecation.RuntimeV1)
case plugin.RuntimeRuncV1:
log.G(ctx).Warnf("%q is deprecated since containerd v1.4 and will be removed in containerd v2.0, use %q instead", plugin.RuntimeRuncV1, plugin.RuntimeRuncV2)
l.warnings.Emit(ctx, deprecation.RuntimeRuncV1)
}
}
func (l *local) Start(ctx context.Context, r *api.StartRequest, _ ...grpc.CallOption) (*api.StartResponse, error) {
Expand Down

0 comments on commit f471bb2

Please sign in to comment.