Use Platform instead of generated API
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/containerd/containerd/api/services/sandbox/v1"
|
||||
"github.com/containerd/containerd/api/types"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
)
|
||||
|
||||
// Controller is an interface to manage sandboxes at runtime.
|
||||
@@ -33,7 +33,7 @@ type Controller interface {
|
||||
Start(ctx context.Context, sandboxID string) (*sandbox.ControllerStartResponse, error)
|
||||
// Platform returns target sandbox OS that will be used by Controller.
|
||||
// containerd will rely on this to generate proper OCI spec.
|
||||
Platform(_ctx context.Context, _sandboxID string) (*types.Platform, error)
|
||||
Platform(_ctx context.Context, _sandboxID string) (platforms.Platform, error)
|
||||
// Stop will stop sandbox instance
|
||||
Stop(ctx context.Context, sandboxID string) (*sandbox.ControllerStopResponse, error)
|
||||
// Wait blocks until sandbox process exits.
|
||||
|
||||
@@ -20,8 +20,8 @@ import (
|
||||
"context"
|
||||
|
||||
api "github.com/containerd/containerd/api/services/sandbox/v1"
|
||||
"github.com/containerd/containerd/api/types"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
sb "github.com/containerd/containerd/sandbox"
|
||||
)
|
||||
|
||||
@@ -55,13 +55,18 @@ func (s *remoteSandboxController) Start(ctx context.Context, sandboxID string) (
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *remoteSandboxController) Platform(ctx context.Context, sandboxID string) (*types.Platform, error) {
|
||||
func (s *remoteSandboxController) Platform(ctx context.Context, sandboxID string) (platforms.Platform, error) {
|
||||
resp, err := s.client.Platform(ctx, &api.ControllerPlatformRequest{SandboxID: sandboxID})
|
||||
if err != nil {
|
||||
return nil, errdefs.FromGRPC(err)
|
||||
return platforms.Platform{}, errdefs.FromGRPC(err)
|
||||
}
|
||||
|
||||
return resp.GetPlatform(), nil
|
||||
platform := resp.GetPlatform()
|
||||
return platforms.Platform{
|
||||
Architecture: platform.GetArchitecture(),
|
||||
OS: platform.GetOS(),
|
||||
Variant: platform.GetVariant(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *remoteSandboxController) Stop(ctx context.Context, sandboxID string) (*api.ControllerStopResponse, error) {
|
||||
|
||||
Reference in New Issue
Block a user