Merge pull request #8417 from dmcgowan/add-proxy-platforms
Add platform config to proxy plugins
This commit is contained in:
commit
ab843a1e2d
@ -169,6 +169,7 @@ type CgroupConfig struct {
|
||||
type ProxyPlugin struct {
|
||||
Type string `toml:"type"`
|
||||
Address string `toml:"address"`
|
||||
Platform string `toml:"platform"`
|
||||
}
|
||||
|
||||
// Decode unmarshals a plugin specific configuration by plugin id
|
||||
|
@ -45,6 +45,7 @@ import (
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/pkg/dialer"
|
||||
"github.com/containerd/containerd/pkg/timeout"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
srvconfig "github.com/containerd/containerd/services/server/config"
|
||||
ssproxy "github.com/containerd/containerd/snapshots/proxy"
|
||||
@ -53,6 +54,7 @@ import (
|
||||
"github.com/docker/go-metrics"
|
||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/backoff"
|
||||
@ -396,6 +398,8 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
|
||||
f func(*grpc.ClientConn) interface{}
|
||||
|
||||
address = pp.Address
|
||||
p v1.Platform
|
||||
err error
|
||||
)
|
||||
|
||||
switch pp.Type {
|
||||
@ -419,12 +423,21 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
|
||||
default:
|
||||
log.G(ctx).WithField("type", pp.Type).Warn("unknown proxy plugin type")
|
||||
}
|
||||
if pp.Platform != "" {
|
||||
p, err = platforms.Parse(pp.Platform)
|
||||
if err != nil {
|
||||
log.G(ctx).WithError(err).WithField("plugin", name).Warn("skipping proxy platform with bad platform")
|
||||
}
|
||||
} else {
|
||||
p = platforms.DefaultSpec()
|
||||
}
|
||||
|
||||
plugin.Register(&plugin.Registration{
|
||||
Type: t,
|
||||
ID: name,
|
||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||
ic.Meta.Exports["address"] = address
|
||||
ic.Meta.Platforms = append(ic.Meta.Platforms, p)
|
||||
conn, err := clients.getClient(address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user