@@ -35,6 +35,17 @@ import (
3535 "sync/atomic"
3636 "time"
3737
38+ "github.com/containerd/ttrpc"
39+ metrics "github.com/docker/go-metrics"
40+ grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
41+ grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
42+ bolt "go.etcd.io/bbolt"
43+ "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
44+ "google.golang.org/grpc"
45+ "google.golang.org/grpc/backoff"
46+ "google.golang.org/grpc/credentials"
47+ "google.golang.org/grpc/credentials/insecure"
48+
3849 csapi "github.com/containerd/containerd/api/services/content/v1"
3950 ssapi "github.com/containerd/containerd/api/services/snapshots/v1"
4051 "github.com/containerd/containerd/content"
@@ -49,19 +60,10 @@ import (
4960 "github.com/containerd/containerd/pkg/timeout"
5061 "github.com/containerd/containerd/plugin"
5162 srvconfig "github.com/containerd/containerd/services/server/config"
63+ "github.com/containerd/containerd/services/warning"
5264 "github.com/containerd/containerd/snapshots"
5365 ssproxy "github.com/containerd/containerd/snapshots/proxy"
5466 "github.com/containerd/containerd/sys"
55- "github.com/containerd/ttrpc"
56- metrics "github.com/docker/go-metrics"
57- grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
58- grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
59- bolt "go.etcd.io/bbolt"
60- "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
61- "google.golang.org/grpc"
62- "google.golang.org/grpc/backoff"
63- "google.golang.org/grpc/credentials"
64- "google.golang.org/grpc/credentials/insecure"
6567)
6668
6769const (
@@ -306,9 +308,33 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
306308 return nil , err
307309 }
308310 }
311+
312+ recordConfigDeprecations (ctx , config , initialized )
309313 return s , nil
310314}
311315
316+ // recordConfigDeprecations attempts to record use of any deprecated config field. Failures are logged and ignored.
317+ func recordConfigDeprecations (ctx context.Context , config * srvconfig.Config , set * plugin.Set ) {
318+ // record any detected deprecations without blocking server startup
319+ plugin , err := set .GetByID (plugin .WarningPlugin , plugin .DeprecationsPlugin )
320+ if err != nil {
321+ log .G (ctx ).WithError (err ).Warn ("failed to load warning service to record deprecations" )
322+ return
323+ }
324+ instance , err := plugin .Instance ()
325+ if err != nil {
326+ log .G (ctx ).WithError (err ).Warn ("failed to load warning service to record deprecations" )
327+ return
328+ }
329+ warn , ok := instance .(warning.Service )
330+ if ! ok {
331+ log .G (ctx ).WithError (err ).Warn ("failed to load warning service to record deprecations, unexpected plugin type" )
332+ return
333+ }
334+
335+ _ = warn // TODO(samuelkarp): placeholder for future use
336+ }
337+
312338// Server is the containerd main daemon
313339type Server struct {
314340 grpcServer * grpc.Server
0 commit comments