Merge pull request #8775 from dcantah/sb-change-mount
Sandbox: Change to mount.Mount for CreateOptions
This commit is contained in:
commit
8c857748d9
@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/containerd/containerd/events"
|
"github.com/containerd/containerd/events"
|
||||||
"github.com/containerd/containerd/events/exchange"
|
"github.com/containerd/containerd/events/exchange"
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
"github.com/containerd/containerd/runtime"
|
"github.com/containerd/containerd/runtime"
|
||||||
@ -144,7 +145,7 @@ func (c *controllerLocal) Create(ctx context.Context, sandboxID string, opts ...
|
|||||||
if _, err := svc.CreateSandbox(ctx, &runtimeAPI.CreateSandboxRequest{
|
if _, err := svc.CreateSandbox(ctx, &runtimeAPI.CreateSandboxRequest{
|
||||||
SandboxID: sandboxID,
|
SandboxID: sandboxID,
|
||||||
BundlePath: shim.Bundle(),
|
BundlePath: shim.Bundle(),
|
||||||
Rootfs: coptions.Rootfs,
|
Rootfs: mount.ToProto(coptions.Rootfs),
|
||||||
Options: options,
|
Options: options,
|
||||||
NetnsPath: coptions.NetNSPath,
|
NetnsPath: coptions.NetNSPath,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
@ -22,12 +22,13 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/api/types"
|
"github.com/containerd/containerd/api/types"
|
||||||
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/typeurl/v2"
|
"github.com/containerd/typeurl/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateOptions struct {
|
type CreateOptions struct {
|
||||||
Rootfs []*types.Mount
|
Rootfs []mount.Mount
|
||||||
// Options are used to pass arbitrary options to the shim when creating a new sandbox.
|
// Options are used to pass arbitrary options to the shim when creating a new sandbox.
|
||||||
// CRI will use this to pass PodSandboxConfig.
|
// CRI will use this to pass PodSandboxConfig.
|
||||||
// Don't confuse this with Runtime options, which are passed at shim instance start
|
// Don't confuse this with Runtime options, which are passed at shim instance start
|
||||||
@ -39,8 +40,7 @@ type CreateOptions struct {
|
|||||||
type CreateOpt func(*CreateOptions) error
|
type CreateOpt func(*CreateOptions) error
|
||||||
|
|
||||||
// WithRootFS is used to create a sandbox with the provided rootfs mount
|
// WithRootFS is used to create a sandbox with the provided rootfs mount
|
||||||
// TODO: Switch to mount.Mount once target added
|
func WithRootFS(m []mount.Mount) CreateOpt {
|
||||||
func WithRootFS(m []*types.Mount) CreateOpt {
|
|
||||||
return func(co *CreateOptions) error {
|
return func(co *CreateOptions) error {
|
||||||
co.Rootfs = m
|
co.Rootfs = m
|
||||||
return nil
|
return nil
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
api "github.com/containerd/containerd/api/services/sandbox/v1"
|
api "github.com/containerd/containerd/api/services/sandbox/v1"
|
||||||
"github.com/containerd/containerd/api/types"
|
"github.com/containerd/containerd/api/types"
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/sandbox"
|
"github.com/containerd/containerd/sandbox"
|
||||||
"google.golang.org/protobuf/types/known/anypb"
|
"google.golang.org/protobuf/types/known/anypb"
|
||||||
@ -46,7 +47,7 @@ func (s *remoteSandboxController) Create(ctx context.Context, sandboxID string,
|
|||||||
}
|
}
|
||||||
_, err := s.client.Create(ctx, &api.ControllerCreateRequest{
|
_, err := s.client.Create(ctx, &api.ControllerCreateRequest{
|
||||||
SandboxID: sandboxID,
|
SandboxID: sandboxID,
|
||||||
Rootfs: options.Rootfs,
|
Rootfs: mount.ToProto(options.Rootfs),
|
||||||
Options: &anypb.Any{
|
Options: &anypb.Any{
|
||||||
TypeUrl: options.Options.GetTypeUrl(),
|
TypeUrl: options.Options.GetTypeUrl(),
|
||||||
Value: options.Options.GetValue(),
|
Value: options.Options.GetValue(),
|
||||||
|
Loading…
Reference in New Issue
Block a user