@@ -38,6 +38,7 @@ import (
3838 "github.com/docker/go-metrics"
3939 grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
4040 grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
41+ v1 "github.com/opencontainers/image-spec/specs-go/v1"
4142 "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
4243 "google.golang.org/grpc"
4344 "google.golang.org/grpc/backoff"
@@ -57,6 +58,7 @@ import (
5758 "github.com/containerd/containerd/pkg/deprecation"
5859 "github.com/containerd/containerd/pkg/dialer"
5960 "github.com/containerd/containerd/pkg/timeout"
61+ "github.com/containerd/containerd/platforms"
6062 "github.com/containerd/containerd/plugin"
6163 srvconfig "github.com/containerd/containerd/services/server/config"
6264 "github.com/containerd/containerd/services/warning"
@@ -454,6 +456,8 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
454456 f func (* grpc.ClientConn ) interface {}
455457
456458 address = pp .Address
459+ p v1.Platform
460+ err error
457461 )
458462
459463 switch pp .Type {
@@ -477,12 +481,21 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
477481 default :
478482 log .G (ctx ).WithField ("type" , pp .Type ).Warn ("unknown proxy plugin type" )
479483 }
484+ if pp .Platform != "" {
485+ p , err = platforms .Parse (pp .Platform )
486+ if err != nil {
487+ log .G (ctx ).WithError (err ).WithField ("plugin" , name ).Warn ("skipping proxy platform with bad platform" )
488+ }
489+ } else {
490+ p = platforms .DefaultSpec ()
491+ }
480492
481493 plugin .Register (& plugin.Registration {
482494 Type : t ,
483495 ID : name ,
484496 InitFn : func (ic * plugin.InitContext ) (interface {}, error ) {
485497 ic .Meta .Exports ["address" ] = address
498+ ic .Meta .Platforms = append (ic .Meta .Platforms , p )
486499 conn , err := clients .getClient (address )
487500 if err != nil {
488501 return nil , err
0 commit comments