From efefd3bf334b5df0e97bff0be61ba906a9b3b528 Mon Sep 17 00:00:00 2001 From: Samuel Karp Date: Thu, 30 Nov 2023 23:20:59 -0800 Subject: [PATCH] tasks: emit warning for runc v1 runtime Signed-off-by: Samuel Karp (cherry picked from commit f471bb2b8e5a902ad8901c7c0db85ecead8c1730) Signed-off-by: Samuel Karp --- pkg/deprecation/deprecation.go | 3 +++ services/tasks/local.go | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/deprecation/deprecation.go b/pkg/deprecation/deprecation.go index 5081399686..c2481bc94d 100644 --- a/pkg/deprecation/deprecation.go +++ b/pkg/deprecation/deprecation.go @@ -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{ @@ -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 diff --git a/services/tasks/local.go b/services/tasks/local.go index 127e3a80f9..40f6979e7d 100644 --- a/services/tasks/local.go +++ b/services/tasks/local.go @@ -219,9 +219,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 { @@ -257,6 +254,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) {