Skip to content

Commit 7cfe705

Browse files
committed
snapshots: emit deprecation warning for aufs
Signed-off-by: Samuel Karp <[email protected]> (cherry picked from commit 625b35e) Signed-off-by: Samuel Karp <[email protected]>
1 parent d8f198a commit 7cfe705

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

pkg/deprecation/deprecation.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const (
3333
CRIRegistryConfigs Warning = Prefix + "cri-registry-configs"
3434
// CRIAPIV1Alpha2 is a warning for the use of CRI-API v1alpha2
3535
CRIAPIV1Alpha2 Warning = Prefix + "cri-api-v1alpha2"
36+
// AUFSSnapshotter is a warning for the use of the aufs snapshotter
37+
AUFSSnapshotter Warning = Prefix + "aufs-snapshotter"
3638
)
3739

3840
var messages = map[Warning]string{
@@ -45,7 +47,8 @@ var messages = map[Warning]string{
4547
"Use `ImagePullSecrets` instead.",
4648
CRIRegistryConfigs: "The `configs` property of `[plugins.\"io.containerd.grpc.v1.cri\".registry]` is deprecated since containerd v1.5 and will be removed in containerd v2.0." +
4749
"Use `config_path` instead.",
48-
CRIAPIV1Alpha2: "CRI API v1alpha2 is deprecated since containerd v1.7 and removed in containerd v2.0. Use CRI API v1 instead.",
50+
CRIAPIV1Alpha2: "CRI API v1alpha2 is deprecated since containerd v1.7 and removed in containerd v2.0. Use CRI API v1 instead.",
51+
AUFSSnapshotter: "The aufs snapshotter is deprecated since containerd v1.5 and removed in containerd v2.0. Use the overlay snapshotter instead.",
4952
}
5053

5154
// Valid checks whether a given Warning is valid

services/snapshots/service.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ import (
2525
"github.com/containerd/containerd/errdefs"
2626
"github.com/containerd/containerd/log"
2727
"github.com/containerd/containerd/mount"
28+
"github.com/containerd/containerd/pkg/deprecation"
2829
"github.com/containerd/containerd/plugin"
2930
"github.com/containerd/containerd/services"
31+
"github.com/containerd/containerd/services/warning"
3032
"github.com/containerd/containerd/snapshots"
3133
ptypes "github.com/gogo/protobuf/types"
3234
"google.golang.org/grpc"
@@ -38,6 +40,7 @@ func init() {
3840
ID: "snapshots",
3941
Requires: []plugin.Type{
4042
plugin.ServicePlugin,
43+
plugin.WarningPlugin,
4144
},
4245
InitFn: newService,
4346
})
@@ -46,7 +49,8 @@ func init() {
4649
var empty = &ptypes.Empty{}
4750

4851
type service struct {
49-
ss map[string]snapshots.Snapshotter
52+
ss map[string]snapshots.Snapshotter
53+
warnings warning.Service
5054
}
5155

5256
func newService(ic *plugin.InitContext) (interface{}, error) {
@@ -63,7 +67,14 @@ func newService(ic *plugin.InitContext) (interface{}, error) {
6367
return nil, err
6468
}
6569
ss := i.(map[string]snapshots.Snapshotter)
66-
return &service{ss: ss}, nil
70+
w, err := ic.Get(plugin.WarningPlugin)
71+
if err != nil {
72+
return nil, err
73+
}
74+
return &service{
75+
ss: ss,
76+
warnings: w.(warning.Service),
77+
}, nil
6778
}
6879

6980
func (s *service) getSnapshotter(name string) (snapshots.Snapshotter, error) {
@@ -145,6 +156,7 @@ func (s *service) Commit(ctx context.Context, cr *snapshotsapi.CommitSnapshotReq
145156
if err != nil {
146157
return nil, err
147158
}
159+
s.emitSnapshotterWarning(ctx, cr.Snapshotter)
148160

149161
var opts []snapshots.Opt
150162
if cr.Labels != nil {
@@ -274,6 +286,14 @@ func (s *service) Cleanup(ctx context.Context, cr *snapshotsapi.CleanupRequest)
274286
return empty, nil
275287
}
276288

289+
func (s *service) emitSnapshotterWarning(ctx context.Context, sn string) {
290+
switch sn {
291+
case "aufs":
292+
log.G(ctx).Warn("aufs snapshotter is deprecated")
293+
s.warnings.Emit(ctx, deprecation.AUFSSnapshotter)
294+
}
295+
}
296+
277297
func fromKind(kind snapshots.Kind) snapshotsapi.Kind {
278298
if kind == snapshots.KindActive {
279299
return snapshotsapi.KindActive

0 commit comments

Comments
 (0)