@@ -45,6 +45,7 @@ import (
4545 "github.com/containerd/containerd/log"
4646 "github.com/containerd/containerd/pkg/dialer"
4747 "github.com/containerd/containerd/pkg/timeout"
48+ "github.com/containerd/containerd/platforms"
4849 "github.com/containerd/containerd/plugin"
4950 srvconfig "github.com/containerd/containerd/services/server/config"
5051 ssproxy "github.com/containerd/containerd/snapshots/proxy"
@@ -53,6 +54,7 @@ import (
5354 "github.com/docker/go-metrics"
5455 grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
5556 grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
57+ v1 "github.com/opencontainers/image-spec/specs-go/v1"
5658 "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
5759 "google.golang.org/grpc"
5860 "google.golang.org/grpc/backoff"
@@ -396,6 +398,8 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
396398 f func (* grpc.ClientConn ) interface {}
397399
398400 address = pp .Address
401+ p v1.Platform
402+ err error
399403 )
400404
401405 switch pp .Type {
@@ -419,12 +423,21 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
419423 default :
420424 log .G (ctx ).WithField ("type" , pp .Type ).Warn ("unknown proxy plugin type" )
421425 }
426+ if pp .Platform != "" {
427+ p , err = platforms .Parse (pp .Platform )
428+ if err != nil {
429+ log .G (ctx ).WithError (err ).WithField ("plugin" , name ).Warn ("skipping proxy platform with bad platform" )
430+ }
431+ } else {
432+ p = platforms .DefaultSpec ()
433+ }
422434
423435 plugin .Register (& plugin.Registration {
424436 Type : t ,
425437 ID : name ,
426438 InitFn : func (ic * plugin.InitContext ) (interface {}, error ) {
427439 ic .Meta .Exports ["address" ] = address
440+ ic .Meta .Platforms = append (ic .Meta .Platforms , p )
428441 conn , err := clients .getClient (address )
429442 if err != nil {
430443 return nil , err
0 commit comments