Cleanup introspection interface

Split service proxy from service plugin.
Make introspection service easier for clients to use.
Update service proxy to support grpc and ttrpc.

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2024-03-01 23:06:22 -08:00
parent 9a2b85561a
commit 1bf781d8eb
14 changed files with 195 additions and 159 deletions

View File

@@ -24,7 +24,6 @@ import (
containerd "github.com/containerd/containerd/v2/client"
"github.com/containerd/containerd/v2/pkg/epoch"
"github.com/containerd/containerd/v2/pkg/namespaces"
ptypes "github.com/containerd/containerd/v2/protobuf/types"
"github.com/containerd/log"
"github.com/urfave/cli/v2"
)
@@ -73,7 +72,7 @@ func NewClient(context *cli.Context, opts ...containerd.Opt) (*containerd.Client
}
}
if !suppressDeprecationWarnings {
resp, err := client.IntrospectionService().Server(ctx, &ptypes.Empty{})
resp, err := client.IntrospectionService().Server(ctx)
if err != nil {
log.L.WithError(err).Warn("Failed to check deprecations")
} else {

View File

@@ -27,7 +27,6 @@ import (
api "github.com/containerd/containerd/v2/api/services/introspection/v1"
"github.com/containerd/containerd/v2/cmd/ctr/commands"
"github.com/containerd/containerd/v2/protobuf"
ptypes "github.com/containerd/containerd/v2/protobuf/types"
)
// Command is the parent for all commands under "deprecations"
@@ -56,7 +55,7 @@ var listCommand = &cli.Command{
}
defer cancel()
resp, err := client.IntrospectionService().Server(ctx, &ptypes.Empty{})
resp, err := client.IntrospectionService().Server(ctx)
if err != nil {
return err
}

View File

@@ -19,7 +19,6 @@ package info
import (
api "github.com/containerd/containerd/v2/api/services/introspection/v1"
"github.com/containerd/containerd/v2/cmd/ctr/commands"
ptypes "github.com/containerd/containerd/v2/protobuf/types"
"github.com/urfave/cli/v2"
)
@@ -38,7 +37,7 @@ var Command = &cli.Command{
}
defer cancel()
var info Info
info.Server, err = client.IntrospectionService().Server(ctx, &ptypes.Empty{})
info.Server, err = client.IntrospectionService().Server(ctx)
if err != nil {
return err
}

View File

@@ -71,7 +71,7 @@ var listCommand = &cli.Command{
}
defer cancel()
ps := client.IntrospectionService()
response, err := ps.Plugins(ctx, context.Args().Slice())
response, err := ps.Plugins(ctx, context.Args().Slice()...)
if err != nil {
return err
}