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 083f7a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/deprecation/deprecation.go
Original file line number Diff line number Diff line change
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
5 changes: 4 additions & 1 deletion services/tasks/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (l *local) Create(ctx context.Context, r *api.CreateTaskRequest, _ ...grpc.
})
}
if container.Runtime.Name == plugin.RuntimeRuncV1 {

Check failure on line 234 in services/tasks/local.go

View workflow job for this annotation

GitHub Actions / Linters (ubuntu-20.04)

SA9003: empty branch (staticcheck)
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)
Expand Down Expand Up @@ -269,6 +269,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 083f7a6

Please sign in to comment.