@@ -34,6 +34,18 @@ import (
3434 "sync/atomic"
3535 "time"
3636
37+ "github.com/containerd/log"
38+ "github.com/containerd/ttrpc"
39+ "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+ v1 "github.com/opencontainers/image-spec/specs-go/v1"
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+
3749 csapi "github.com/containerd/containerd/api/services/content/v1"
3850 diffapi "github.com/containerd/containerd/api/services/diff/v1"
3951 sbapi "github.com/containerd/containerd/api/services/sandbox/v1"
@@ -52,19 +64,9 @@ import (
5264 "github.com/containerd/containerd/plugins"
5365 sbproxy "github.com/containerd/containerd/sandbox/proxy"
5466 srvconfig "github.com/containerd/containerd/services/server/config"
67+ "github.com/containerd/containerd/services/warning"
5568 ssproxy "github.com/containerd/containerd/snapshots/proxy"
5669 "github.com/containerd/containerd/sys"
57- "github.com/containerd/log"
58- "github.com/containerd/ttrpc"
59- "github.com/docker/go-metrics"
60- grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
61- grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
62- v1 "github.com/opencontainers/image-spec/specs-go/v1"
63- "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
64- "google.golang.org/grpc"
65- "google.golang.org/grpc/backoff"
66- "google.golang.org/grpc/credentials"
67- "google.golang.org/grpc/credentials/insecure"
6870)
6971
7072// CreateTopLevelDirectories creates the top-level root and state directories.
@@ -330,9 +332,33 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
330332 return nil , err
331333 }
332334 }
335+
336+ recordConfigDeprecations (ctx , config , initialized )
333337 return s , nil
334338}
335339
340+ // recordConfigDeprecations attempts to record use of any deprecated config field. Failures are logged and ignored.
341+ func recordConfigDeprecations (ctx context.Context , config * srvconfig.Config , set * plugin.Set ) {
342+ // record any detected deprecations without blocking server startup
343+ plugin , err := set .GetByID (plugins .WarningPlugin , plugins .DeprecationsPlugin )
344+ if err != nil {
345+ log .G (ctx ).WithError (err ).Warn ("failed to load warning service to record deprecations" )
346+ return
347+ }
348+ instance , err := plugin .Instance ()
349+ if err != nil {
350+ log .G (ctx ).WithError (err ).Warn ("failed to load warning service to record deprecations" )
351+ return
352+ }
353+ warn , ok := instance .(warning.Service )
354+ if ! ok {
355+ log .G (ctx ).WithError (err ).Warn ("failed to load warning service to record deprecations, unexpected plugin type" )
356+ return
357+ }
358+
359+ _ = warn // TODO(samuelkarp): placeholder for future use
360+ }
361+
336362// Server is the containerd main daemon
337363type Server struct {
338364 grpcServer * grpc.Server
@@ -433,7 +459,7 @@ func (s *Server) Wait() {
433459// of all plugins.
434460func LoadPlugins (ctx context.Context , config * srvconfig.Config ) ([]plugin.Registration , error ) {
435461 // load all plugins into containerd
436- path := config .PluginDir //nolint: staticcheck
462+ path := config .PluginDir // nolint: staticcheck
437463 if path == "" {
438464 path = filepath .Join (config .Root , "plugins" )
439465 }
0 commit comments