Move Container and runtime to plugin pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
fa4e114979
commit
01b9f5ec67
@ -263,8 +263,8 @@ func resolveMetaDB(ctx *cli.Context) (*bolt.DB, error) {
|
|||||||
return db, nil
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadRuntimes(monitor plugin.ContainerMonitor) (map[string]containerd.Runtime, error) {
|
func loadRuntimes(monitor plugin.ContainerMonitor) (map[string]plugin.Runtime, error) {
|
||||||
o := make(map[string]containerd.Runtime)
|
o := make(map[string]plugin.Runtime)
|
||||||
for name, rr := range plugin.Registrations() {
|
for name, rr := range plugin.Registrations() {
|
||||||
if rr.Type != plugin.RuntimePlugin {
|
if rr.Type != plugin.RuntimePlugin {
|
||||||
continue
|
continue
|
||||||
@ -286,7 +286,7 @@ func loadRuntimes(monitor plugin.ContainerMonitor) (map[string]containerd.Runtim
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
o[name] = vr.(containerd.Runtime)
|
o[name] = vr.(plugin.Runtime)
|
||||||
}
|
}
|
||||||
return o, nil
|
return o, nil
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ func newGRPCServer() *grpc.Server {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadServices(runtimes map[string]containerd.Runtime, store content.Store, sn snapshot.Snapshotter, meta *bolt.DB) ([]plugin.Service, error) {
|
func loadServices(runtimes map[string]plugin.Runtime, store content.Store, sn snapshot.Snapshotter, meta *bolt.DB) ([]plugin.Service, error) {
|
||||||
var o []plugin.Service
|
var o []plugin.Service
|
||||||
for name, sr := range plugin.Registrations() {
|
for name, sr := range plugin.Registrations() {
|
||||||
if sr.Type != plugin.GRPCPlugin {
|
if sr.Type != plugin.GRPCPlugin {
|
||||||
|
@ -3,24 +3,25 @@
|
|||||||
package linux
|
package linux
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd"
|
"context"
|
||||||
|
|
||||||
"github.com/containerd/containerd/api/services/shim"
|
"github.com/containerd/containerd/api/services/shim"
|
||||||
"github.com/containerd/containerd/api/types/container"
|
"github.com/containerd/containerd/api/types/container"
|
||||||
|
"github.com/containerd/containerd/plugin"
|
||||||
protobuf "github.com/gogo/protobuf/types"
|
protobuf "github.com/gogo/protobuf/types"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type State struct {
|
type State struct {
|
||||||
pid uint32
|
pid uint32
|
||||||
status containerd.Status
|
status plugin.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s State) Pid() uint32 {
|
func (s State) Pid() uint32 {
|
||||||
return s.pid
|
return s.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s State) Status() containerd.Status {
|
func (s State) Status() plugin.Status {
|
||||||
return s.status
|
return s.status
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,8 +38,8 @@ type Container struct {
|
|||||||
shim shim.ShimClient
|
shim shim.ShimClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Container) Info() containerd.ContainerInfo {
|
func (c *Container) Info() plugin.ContainerInfo {
|
||||||
return containerd.ContainerInfo{
|
return plugin.ContainerInfo{
|
||||||
ID: c.id,
|
ID: c.id,
|
||||||
Runtime: runtimeName,
|
Runtime: runtimeName,
|
||||||
}
|
}
|
||||||
@ -49,21 +50,21 @@ func (c *Container) Start(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Container) State(ctx context.Context) (containerd.State, error) {
|
func (c *Container) State(ctx context.Context) (plugin.State, error) {
|
||||||
response, err := c.shim.State(ctx, &shim.StateRequest{})
|
response, err := c.shim.State(ctx, &shim.StateRequest{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var status containerd.Status
|
var status plugin.Status
|
||||||
switch response.Status {
|
switch response.Status {
|
||||||
case container.Status_CREATED:
|
case container.Status_CREATED:
|
||||||
status = containerd.CreatedStatus
|
status = plugin.CreatedStatus
|
||||||
case container.Status_RUNNING:
|
case container.Status_RUNNING:
|
||||||
status = containerd.RunningStatus
|
status = plugin.RunningStatus
|
||||||
case container.Status_STOPPED:
|
case container.Status_STOPPED:
|
||||||
status = containerd.StoppedStatus
|
status = plugin.StoppedStatus
|
||||||
case container.Status_PAUSED:
|
case container.Status_PAUSED:
|
||||||
status = containerd.PausedStatus
|
status = plugin.PausedStatus
|
||||||
// TODO: containerd.DeletedStatus
|
// TODO: containerd.DeletedStatus
|
||||||
}
|
}
|
||||||
return &State{
|
return &State{
|
||||||
@ -90,7 +91,7 @@ func (c *Container) Kill(ctx context.Context, signal uint32, all bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Container) Exec(ctx context.Context, opts containerd.ExecOpts) (containerd.Process, error) {
|
func (c *Container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Process, error) {
|
||||||
request := &shim.ExecRequest{
|
request := &shim.ExecRequest{
|
||||||
Stdin: opts.IO.Stdin,
|
Stdin: opts.IO.Stdin,
|
||||||
Stdout: opts.IO.Stdout,
|
Stdout: opts.IO.Stdout,
|
||||||
@ -110,7 +111,7 @@ func (c *Container) Exec(ctx context.Context, opts containerd.ExecOpts) (contain
|
|||||||
c: c,
|
c: c,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
func (c *Container) Pty(ctx context.Context, pid uint32, size containerd.ConsoleSize) error {
|
func (c *Container) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error {
|
||||||
_, err := c.shim.Pty(ctx, &shim.PtyRequest{
|
_, err := c.shim.Pty(ctx, &shim.PtyRequest{
|
||||||
Pid: pid,
|
Pid: pid,
|
||||||
Width: size.Width,
|
Width: size.Width,
|
||||||
@ -139,7 +140,7 @@ func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) State(ctx context.Context) (containerd.State, error) {
|
func (p *Process) State(ctx context.Context) (plugin.State, error) {
|
||||||
// use the container status for the status of the process
|
// use the container status for the status of the process
|
||||||
state, err := p.c.State(ctx)
|
state, err := p.c.State(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -4,6 +4,7 @@ package linux
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -19,7 +20,6 @@ import (
|
|||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
runc "github.com/containerd/go-runc"
|
runc "github.com/containerd/go-runc"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = (containerd.Runtime)(&Runtime{})
|
var _ = (plugin.Runtime)(&Runtime{})
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// Runtime is a path or name of an OCI runtime used by the shim
|
// Runtime is a path or name of an OCI runtime used by the shim
|
||||||
@ -81,7 +81,7 @@ type Runtime struct {
|
|||||||
monitor plugin.ContainerMonitor
|
monitor plugin.ContainerMonitor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Runtime) Create(ctx context.Context, id string, opts containerd.CreateOpts) (containerd.Container, error) {
|
func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (plugin.Container, error) {
|
||||||
path, err := r.newBundle(id, opts.Spec)
|
path, err := r.newBundle(id, opts.Spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -123,7 +123,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts containerd.CreateO
|
|||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Runtime) Delete(ctx context.Context, c containerd.Container) (*containerd.Exit, error) {
|
func (r *Runtime) Delete(ctx context.Context, c plugin.Container) (*plugin.Exit, error) {
|
||||||
lc, ok := c.(*Container)
|
lc, ok := c.(*Container)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("container cannot be cast as *linux.Container")
|
return nil, fmt.Errorf("container cannot be cast as *linux.Container")
|
||||||
@ -138,18 +138,18 @@ func (r *Runtime) Delete(ctx context.Context, c containerd.Container) (*containe
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
lc.shim.Exit(ctx, &shim.ExitRequest{})
|
lc.shim.Exit(ctx, &shim.ExitRequest{})
|
||||||
return &containerd.Exit{
|
return &plugin.Exit{
|
||||||
Status: rsp.ExitStatus,
|
Status: rsp.ExitStatus,
|
||||||
Timestamp: rsp.ExitedAt,
|
Timestamp: rsp.ExitedAt,
|
||||||
}, r.deleteBundle(lc.id)
|
}, r.deleteBundle(lc.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Runtime) Containers(ctx context.Context) ([]containerd.Container, error) {
|
func (r *Runtime) Containers(ctx context.Context) ([]plugin.Container, error) {
|
||||||
dir, err := ioutil.ReadDir(r.root)
|
dir, err := ioutil.ReadDir(r.root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var o []containerd.Container
|
var o []plugin.Container
|
||||||
for _, fi := range dir {
|
for _, fi := range dir {
|
||||||
if !fi.IsDir() {
|
if !fi.IsDir() {
|
||||||
continue
|
continue
|
||||||
|
@ -44,9 +44,9 @@ type cgroupsMonitor struct {
|
|||||||
events chan<- *containerd.Event
|
events chan<- *containerd.Event
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *cgroupsMonitor) Monitor(c containerd.Container) error {
|
func (m *cgroupsMonitor) Monitor(c plugin.Container) error {
|
||||||
// skip non-linux containers
|
// skip non-linux containers
|
||||||
if _, ok := c.(containerd.LinuxContainer); !ok {
|
if _, ok := c.(plugin.LinuxContainer); !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
id := c.Info().ID
|
id := c.Info().ID
|
||||||
@ -64,8 +64,8 @@ func (m *cgroupsMonitor) Monitor(c containerd.Container) error {
|
|||||||
return m.oom.Add(id, cg, m.trigger)
|
return m.oom.Add(id, cg, m.trigger)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *cgroupsMonitor) Stop(c containerd.Container) error {
|
func (m *cgroupsMonitor) Stop(c plugin.Container) error {
|
||||||
if _, ok := c.(containerd.LinuxContainer); !ok {
|
if _, ok := c.(plugin.LinuxContainer); !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
m.collector.Remove(c.Info().ID)
|
m.collector.Remove(c.Info().ID)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package containerd
|
package plugin
|
||||||
|
|
||||||
import "golang.org/x/net/context"
|
import "context"
|
||||||
|
|
||||||
type ContainerInfo struct {
|
type ContainerInfo struct {
|
||||||
ID string
|
ID string
|
@ -5,9 +5,9 @@ import "github.com/containerd/containerd"
|
|||||||
// ContainerMonitor provides an interface for monitoring of containers within containerd
|
// ContainerMonitor provides an interface for monitoring of containers within containerd
|
||||||
type ContainerMonitor interface {
|
type ContainerMonitor interface {
|
||||||
// Monitor adds the provided container to the monitor
|
// Monitor adds the provided container to the monitor
|
||||||
Monitor(containerd.Container) error
|
Monitor(Container) error
|
||||||
// Stop stops and removes the provided container from the monitor
|
// Stop stops and removes the provided container from the monitor
|
||||||
Stop(containerd.Container) error
|
Stop(Container) error
|
||||||
// Events emits events from the monitor
|
// Events emits events from the monitor
|
||||||
Events(chan<- *containerd.Event)
|
Events(chan<- *containerd.Event)
|
||||||
}
|
}
|
||||||
@ -25,11 +25,11 @@ func NewNoopMonitor() ContainerMonitor {
|
|||||||
type noopContainerMonitor struct {
|
type noopContainerMonitor struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mm *noopContainerMonitor) Monitor(c containerd.Container) error {
|
func (mm *noopContainerMonitor) Monitor(c Container) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mm *noopContainerMonitor) Stop(c containerd.Container) error {
|
func (mm *noopContainerMonitor) Stop(c Container) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ type multiContainerMonitor struct {
|
|||||||
monitors []ContainerMonitor
|
monitors []ContainerMonitor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mm *multiContainerMonitor) Monitor(c containerd.Container) error {
|
func (mm *multiContainerMonitor) Monitor(c Container) error {
|
||||||
for _, m := range mm.monitors {
|
for _, m := range mm.monitors {
|
||||||
if err := m.Monitor(c); err != nil {
|
if err := m.Monitor(c); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -49,7 +49,7 @@ func (mm *multiContainerMonitor) Monitor(c containerd.Container) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mm *multiContainerMonitor) Stop(c containerd.Container) error {
|
func (mm *multiContainerMonitor) Stop(c Container) error {
|
||||||
for _, m := range mm.monitors {
|
for _, m := range mm.monitors {
|
||||||
if err := m.Stop(c); err != nil {
|
if err := m.Stop(c); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
"github.com/containerd/containerd"
|
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
"github.com/containerd/containerd/snapshot"
|
"github.com/containerd/containerd/snapshot"
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ type Registration struct {
|
|||||||
type InitContext struct {
|
type InitContext struct {
|
||||||
Root string
|
Root string
|
||||||
State string
|
State string
|
||||||
Runtimes map[string]containerd.Runtime
|
Runtimes map[string]Runtime
|
||||||
Content content.Store
|
Content content.Store
|
||||||
Meta *bolt.DB
|
Meta *bolt.DB
|
||||||
Snapshotter snapshot.Snapshotter
|
Snapshotter snapshot.Snapshotter
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package containerd
|
package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"github.com/containerd/containerd"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IO struct {
|
type IO struct {
|
||||||
@ -17,7 +18,7 @@ type CreateOpts struct {
|
|||||||
// Spec is the OCI runtime spec
|
// Spec is the OCI runtime spec
|
||||||
Spec []byte
|
Spec []byte
|
||||||
// Rootfs mounts to perform to gain access to the container's filesystem
|
// Rootfs mounts to perform to gain access to the container's filesystem
|
||||||
Rootfs []Mount
|
Rootfs []containerd.Mount
|
||||||
// IO for the container's main process
|
// IO for the container's main process
|
||||||
IO IO
|
IO IO
|
||||||
}
|
}
|
||||||
@ -37,5 +38,5 @@ type Runtime interface {
|
|||||||
// Delete removes the container in the runtime
|
// Delete removes the container in the runtime
|
||||||
Delete(context.Context, Container) (*Exit, error)
|
Delete(context.Context, Container) (*Exit, error)
|
||||||
// Events returns events for the runtime and all containers created by the runtime
|
// Events returns events for the runtime and all containers created by the runtime
|
||||||
Events(context.Context) <-chan *Event
|
Events(context.Context) <-chan *containerd.Event
|
||||||
}
|
}
|
@ -4,11 +4,12 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
|
"github.com/containerd/containerd/plugin"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newCollector(ctx context.Context, runtimes map[string]containerd.Runtime) (*collector, error) {
|
func newCollector(ctx context.Context, runtimes map[string]plugin.Runtime) (*collector, error) {
|
||||||
c := &collector{
|
c := &collector{
|
||||||
context: ctx,
|
context: ctx,
|
||||||
ch: make(chan *containerd.Event, 2048),
|
ch: make(chan *containerd.Event, 2048),
|
||||||
@ -42,7 +43,7 @@ type collector struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// collect collects events from the provided runtime
|
// collect collects events from the provided runtime
|
||||||
func (c *collector) collect(r containerd.Runtime) error {
|
func (c *collector) collect(r plugin.Runtime) error {
|
||||||
c.wg.Add(1)
|
c.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer c.wg.Done()
|
defer c.wg.Done()
|
||||||
|
@ -32,7 +32,7 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
return &Service{
|
return &Service{
|
||||||
runtimes: ic.Runtimes,
|
runtimes: ic.Runtimes,
|
||||||
containers: make(map[string]containerd.Container),
|
containers: make(map[string]plugin.Container),
|
||||||
collector: c,
|
collector: c,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -40,8 +40,8 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
|||||||
type Service struct {
|
type Service struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
|
||||||
runtimes map[string]containerd.Runtime
|
runtimes map[string]plugin.Runtime
|
||||||
containers map[string]containerd.Container
|
containers map[string]plugin.Container
|
||||||
collector *collector
|
collector *collector
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,9 +61,9 @@ func (s *Service) Register(server *grpc.Server) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.CreateResponse, error) {
|
func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.CreateResponse, error) {
|
||||||
opts := containerd.CreateOpts{
|
opts := plugin.CreateOpts{
|
||||||
Spec: r.Spec.Value,
|
Spec: r.Spec.Value,
|
||||||
IO: containerd.IO{
|
IO: plugin.IO{
|
||||||
Stdin: r.Stdin,
|
Stdin: r.Stdin,
|
||||||
Stdout: r.Stdout,
|
Stdout: r.Stdout,
|
||||||
Stderr: r.Stderr,
|
Stderr: r.Stderr,
|
||||||
@ -140,7 +140,7 @@ func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*api.Delete
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func containerFromContainerd(ctx context.Context, c containerd.Container) (*container.Container, error) {
|
func containerFromContainerd(ctx context.Context, c plugin.Container) (*container.Container, error) {
|
||||||
state, err := c.State(ctx)
|
state, err := c.State(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -148,13 +148,13 @@ func containerFromContainerd(ctx context.Context, c containerd.Container) (*cont
|
|||||||
|
|
||||||
var status container.Status
|
var status container.Status
|
||||||
switch state.Status() {
|
switch state.Status() {
|
||||||
case containerd.CreatedStatus:
|
case plugin.CreatedStatus:
|
||||||
status = container.Status_CREATED
|
status = container.Status_CREATED
|
||||||
case containerd.RunningStatus:
|
case plugin.RunningStatus:
|
||||||
status = container.Status_RUNNING
|
status = container.Status_RUNNING
|
||||||
case containerd.StoppedStatus:
|
case plugin.StoppedStatus:
|
||||||
status = container.Status_STOPPED
|
status = container.Status_STOPPED
|
||||||
case containerd.PausedStatus:
|
case plugin.PausedStatus:
|
||||||
status = container.Status_PAUSED
|
status = container.Status_PAUSED
|
||||||
default:
|
default:
|
||||||
log.G(ctx).WithField("status", state.Status()).Warn("unknown status")
|
log.G(ctx).WithField("status", state.Status()).Warn("unknown status")
|
||||||
@ -235,9 +235,9 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecRequest) (*api.ExecRespon
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
process, err := c.Exec(ctx, containerd.ExecOpts{
|
process, err := c.Exec(ctx, plugin.ExecOpts{
|
||||||
Spec: r.Spec.Value,
|
Spec: r.Spec.Value,
|
||||||
IO: containerd.IO{
|
IO: plugin.IO{
|
||||||
Stdin: r.Stdin,
|
Stdin: r.Stdin,
|
||||||
Stdout: r.Stdout,
|
Stdout: r.Stdout,
|
||||||
Stderr: r.Stderr,
|
Stderr: r.Stderr,
|
||||||
@ -261,7 +261,7 @@ func (s *Service) Pty(ctx context.Context, r *api.PtyRequest) (*google_protobuf.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := c.Pty(ctx, r.Pid, containerd.ConsoleSize{
|
if err := c.Pty(ctx, r.Pid, plugin.ConsoleSize{
|
||||||
Width: r.Width,
|
Width: r.Width,
|
||||||
Height: r.Height,
|
Height: r.Height,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@ -281,7 +281,7 @@ func (s *Service) CloseStdin(ctx context.Context, r *api.CloseStdinRequest) (*go
|
|||||||
return empty, nil
|
return empty, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) getContainer(id string) (containerd.Container, error) {
|
func (s *Service) getContainer(id string) (plugin.Container, error) {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
c, ok := s.containers[id]
|
c, ok := s.containers[id]
|
||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
@ -291,7 +291,7 @@ func (s *Service) getContainer(id string) (containerd.Container, error) {
|
|||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) getRuntime(name string) (containerd.Runtime, error) {
|
func (s *Service) getRuntime(name string) (plugin.Runtime, error) {
|
||||||
runtime, ok := s.runtimes[name]
|
runtime, ok := s.runtimes[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, containerd.ErrUnknownRuntime
|
return nil, containerd.ErrUnknownRuntime
|
||||||
|
Loading…
Reference in New Issue
Block a user