Skip to content

Commit

Permalink
Add support for 1.8 interfaces
Browse files Browse the repository at this point in the history
Signed-off-by: Derek McGowan <derek@mcg.dev>
  • Loading branch information
dmcgowan committed May 28, 2024
1 parent 4a2ca38 commit 9df456d
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 6 deletions.
6 changes: 6 additions & 0 deletions api/runtime/sandbox/v1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
*/

package sandbox

// Not implemented types introduced in later versions and included for API compatibility
// Use of these types should only use not implemented errors

type SandboxMetricsRequest struct{}
type SandboxMetricsResponse struct{}
6 changes: 6 additions & 0 deletions api/services/introspection/v1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
*/

package introspection

// Not implemented types introduced in later versions and included for API compatibility
// Use of these types should only use not implemented errors

type PluginInfoRequest struct{}
type PluginInfoResponse struct{}
5 changes: 3 additions & 2 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ package containerd
import (
"context"

"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2"

eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/events"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/errdefs"
"github.com/containerd/typeurl/v2"
)

// EventService handles the publish, forward and subscribe of events.
Expand Down
9 changes: 7 additions & 2 deletions runtime/v2/runc/pause/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ import (
"context"
"runtime"

"github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/pkg/shutdown"
"github.com/containerd/ttrpc"
log "github.com/sirupsen/logrus"

"github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/pkg/shutdown"

api "github.com/containerd/containerd/api/runtime/sandbox/v1"
"github.com/containerd/containerd/plugin"
)
Expand Down Expand Up @@ -108,3 +109,7 @@ func (p *pauseService) PingSandbox(ctx context.Context, req *api.PingRequest) (*
func (p *pauseService) ShutdownSandbox(ctx context.Context, request *api.ShutdownSandboxRequest) (*api.ShutdownSandboxResponse, error) {
return &api.ShutdownSandboxResponse{}, nil
}

func (p *pauseService) SandboxMetrics(ctx context.Context, request *api.SandboxMetricsRequest) (*api.SandboxMetricsResponse, error) {
return &api.SandboxMetricsResponse{}, nil
}
5 changes: 5 additions & 0 deletions sandbox/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"google.golang.org/grpc"

api "github.com/containerd/containerd/api/runtime/sandbox/v1"
"github.com/containerd/containerd/errdefs"
)

// NewClient returns a new sandbox client that handles both GRPC and TTRPC clients.
Expand Down Expand Up @@ -75,3 +76,7 @@ func (g *grpcBridge) PingSandbox(ctx context.Context, request *api.PingRequest)
func (g *grpcBridge) ShutdownSandbox(ctx context.Context, request *api.ShutdownSandboxRequest) (*api.ShutdownSandboxResponse, error) {
return g.client.ShutdownSandbox(ctx, request)
}

func (g *grpcBridge) SandboxMetrics(ctx context.Context, request *api.SandboxMetricsRequest) (*api.SandboxMetricsResponse, error) {
return nil, errdefs.ToGRPC(errdefs.ErrNotImplemented)
}
7 changes: 6 additions & 1 deletion services/introspection/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/status"

"github.com/containerd/errdefs"

api "github.com/containerd/containerd/api/services/introspection/v1"
"github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/filters"
Expand All @@ -38,7 +40,6 @@ import (
ptypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/containerd/services"
"github.com/containerd/containerd/services/warning"
"github.com/containerd/errdefs"
)

func init() {
Expand Down Expand Up @@ -147,6 +148,10 @@ func (l *Local) Server(ctx context.Context, _ *ptypes.Empty, _ ...grpc.CallOptio
}, nil
}

func (l *Local) PluginInfo(ctx context.Context, in *api.PluginInfoRequest, opts ...grpc.CallOption) (*api.PluginInfoResponse, error) {
return nil, errdefs.ErrNotImplemented
}

func (l *Local) getUUID() (string, error) {
l.mu.Lock()
defer l.mu.Unlock()
Expand Down
8 changes: 7 additions & 1 deletion services/introspection/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import (
context "context"
"errors"

"google.golang.org/grpc"

api "github.com/containerd/containerd/api/services/introspection/v1"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/plugin"
ptypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/containerd/services"
"google.golang.org/grpc"
)

func init() {
Expand Down Expand Up @@ -79,3 +81,7 @@ func (s *server) Plugins(ctx context.Context, req *api.PluginsRequest) (*api.Plu
func (s *server) Server(ctx context.Context, empty *ptypes.Empty) (*api.ServerResponse, error) {
return s.local.Server(ctx, empty)
}

func (s *server) PluginInfo(ctx context.Context, in *api.PluginInfoRequest) (*api.PluginInfoResponse, error) {
return nil, errdefs.ToGRPC(errdefs.ErrNotImplemented)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9df456d

Please sign in to comment.