Remove runtime.Event types
This uses the events service types for runtime events Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
7c8acca29a
commit
040558cf81
@ -99,6 +99,7 @@ type RuntimeEvent struct {
|
||||
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||
ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
|
||||
ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"`
|
||||
Timestamp time.Time `protobuf:"bytes,6,opt,name=timestamp,stdtime" json:"timestamp"`
|
||||
}
|
||||
|
||||
func (m *RuntimeEvent) Reset() { *m = RuntimeEvent{} }
|
||||
@ -317,6 +318,14 @@ func (m *RuntimeEvent) MarshalTo(dAtA []byte) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
i += n2
|
||||
dAtA[i] = 0x32
|
||||
i++
|
||||
i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp)))
|
||||
n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n3
|
||||
return i, nil
|
||||
}
|
||||
|
||||
@ -355,11 +364,11 @@ func (m *RuntimeDelete) MarshalTo(dAtA []byte) (int, error) {
|
||||
dAtA[i] = 0x22
|
||||
i++
|
||||
i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt)))
|
||||
n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:])
|
||||
n4, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n3
|
||||
i += n4
|
||||
return i, nil
|
||||
}
|
||||
|
||||
@ -477,6 +486,8 @@ func (m *RuntimeEvent) Size() (n int) {
|
||||
}
|
||||
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt)
|
||||
n += 1 + l + sovRuntime(uint64(l))
|
||||
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp)
|
||||
n += 1 + l + sovRuntime(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
@ -561,6 +572,7 @@ func (this *RuntimeEvent) String() string {
|
||||
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
||||
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
|
||||
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
|
||||
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
@ -1226,6 +1238,36 @@ func (m *RuntimeEvent) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 6:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowRuntime
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthRuntime
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipRuntime(dAtA[iNdEx:])
|
||||
@ -1514,43 +1556,44 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptorRuntime = []byte{
|
||||
// 599 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6a, 0xdb, 0x40,
|
||||
0x10, 0x86, 0x2d, 0xc9, 0x76, 0xec, 0x71, 0x13, 0xc4, 0x12, 0x8a, 0x30, 0x54, 0x0e, 0x3e, 0x19,
|
||||
// 610 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6a, 0xdb, 0x4c,
|
||||
0x10, 0xb6, 0x24, 0x5b, 0xb1, 0xc6, 0x7f, 0x82, 0x58, 0xc2, 0x8f, 0x30, 0x54, 0x0e, 0x3e, 0x19,
|
||||
0x0a, 0x12, 0x71, 0xe9, 0xa9, 0x50, 0x6a, 0xc7, 0x2a, 0xf8, 0x10, 0xdc, 0xae, 0x55, 0x08, 0xbd,
|
||||
0x04, 0x59, 0xda, 0x38, 0x4b, 0x6d, 0xad, 0x58, 0xad, 0x4c, 0x73, 0xeb, 0x23, 0xf4, 0x25, 0xfa,
|
||||
0x12, 0x7d, 0x82, 0x1c, 0x7b, 0xec, 0x29, 0x6d, 0xf4, 0x08, 0x7d, 0x82, 0xa2, 0x5d, 0x59, 0x09,
|
||||
0x85, 0x9a, 0x90, 0x8b, 0x99, 0x7f, 0x98, 0xfd, 0x66, 0xfe, 0xdd, 0xb1, 0xc0, 0x5b, 0x52, 0x71,
|
||||
0x99, 0x2d, 0x9c, 0x90, 0xad, 0xdd, 0x90, 0xc5, 0x22, 0xa0, 0x31, 0xe1, 0xd1, 0xfd, 0x30, 0x48,
|
||||
0xa8, 0x9b, 0x12, 0xbe, 0xa1, 0x21, 0x49, 0x5d, 0xb2, 0x21, 0xb1, 0x48, 0xdd, 0xcd, 0xb1, 0xcb,
|
||||
0xb3, 0x58, 0xd0, 0x35, 0x71, 0x12, 0xce, 0x04, 0x43, 0xcf, 0xee, 0x0e, 0x38, 0xdb, 0x62, 0x47,
|
||||
0x15, 0x3b, 0x9b, 0xe3, 0xee, 0xe1, 0x92, 0x2d, 0x99, 0xac, 0x74, 0x8b, 0x48, 0x1d, 0xea, 0xf6,
|
||||
0x96, 0x8c, 0x2d, 0x57, 0xc4, 0x95, 0x6a, 0x91, 0x5d, 0xb8, 0x05, 0x30, 0x15, 0xc1, 0x3a, 0x51,
|
||||
0x05, 0xfd, 0x35, 0xb4, 0xb1, 0x6a, 0x33, 0x9d, 0xa1, 0x43, 0x68, 0xa4, 0x22, 0xa2, 0xb1, 0xa5,
|
||||
0x1d, 0x69, 0x83, 0x36, 0x56, 0x02, 0x3d, 0x85, 0x66, 0x2a, 0x22, 0x96, 0x09, 0x4b, 0x97, 0xe9,
|
||||
0x52, 0x95, 0x79, 0xc2, 0xb9, 0x65, 0x54, 0x79, 0xc2, 0x39, 0xea, 0x42, 0x4b, 0x10, 0xbe, 0xa6,
|
||||
0x71, 0xb0, 0xb2, 0xea, 0x47, 0xda, 0xa0, 0x85, 0x2b, 0xdd, 0xf7, 0xe1, 0x49, 0xd9, 0xee, 0x94,
|
||||
0x65, 0xb1, 0x40, 0x08, 0xea, 0xe2, 0x2a, 0x21, 0x65, 0x43, 0x19, 0x4b, 0x2e, 0xcb, 0x78, 0x48,
|
||||
0xaa, 0x7e, 0x52, 0x21, 0x0b, 0xf6, 0x58, 0x22, 0x28, 0x8b, 0x53, 0xcb, 0x38, 0x32, 0x06, 0x6d,
|
||||
0xbc, 0x95, 0xfd, 0x3f, 0x1a, 0xec, 0x97, 0xd8, 0x13, 0x4e, 0x02, 0x51, 0x30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80, 0x2a, 0xe2, 0x04,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ message RuntimeEvent {
|
||||
uint32 pid = 3;
|
||||
uint32 exit_status = 4;
|
||||
google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
google.protobuf.Timestamp timestamp = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message RuntimeDelete {
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
@ -91,7 +90,7 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
remote: !cfg.NoShim,
|
||||
shim: cfg.Shim,
|
||||
runtime: cfg.Runtime,
|
||||
events: make(chan *runtime.Event, 2048),
|
||||
events: make(chan *eventsapi.RuntimeEvent, 2048),
|
||||
eventsContext: c,
|
||||
eventsCancel: cancel,
|
||||
monitor: monitor.(runtime.TaskMonitor),
|
||||
@ -122,7 +121,7 @@ type Runtime struct {
|
||||
runtime string
|
||||
remote bool
|
||||
|
||||
events chan *runtime.Event
|
||||
events chan *eventsapi.RuntimeEvent
|
||||
eventsContext context.Context
|
||||
eventsCancel func()
|
||||
monitor runtime.TaskMonitor
|
||||
@ -346,6 +345,7 @@ func (r *Runtime) handleEvents(ctx context.Context, s *client.Client) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// forward forwards events from a shim to the events service and monitors
|
||||
func (r *Runtime) forward(ctx context.Context, events shim.Shim_StreamClient) {
|
||||
for {
|
||||
e, err := events.Recv()
|
||||
@ -355,46 +355,29 @@ func (r *Runtime) forward(ctx context.Context, events shim.Shim_StreamClient) {
|
||||
}
|
||||
return
|
||||
}
|
||||
topic := ""
|
||||
var et runtime.EventType
|
||||
switch e.Type {
|
||||
case shim.Event_CREATE:
|
||||
topic = "task-create"
|
||||
et = runtime.CreateEvent
|
||||
case shim.Event_START:
|
||||
topic = "task-start"
|
||||
et = runtime.StartEvent
|
||||
case shim.Event_EXEC_ADDED:
|
||||
topic = "task-execadded"
|
||||
et = runtime.ExecAddEvent
|
||||
case shim.Event_OOM:
|
||||
topic = "task-oom"
|
||||
et = runtime.OOMEvent
|
||||
case shim.Event_EXIT:
|
||||
topic = "task-exit"
|
||||
et = runtime.ExitEvent
|
||||
}
|
||||
r.events <- &runtime.Event{
|
||||
Timestamp: time.Now(),
|
||||
Runtime: r.ID(),
|
||||
Type: et,
|
||||
Pid: e.Pid,
|
||||
ID: e.ID,
|
||||
ExitStatus: e.ExitStatus,
|
||||
ExitedAt: e.ExitedAt,
|
||||
}
|
||||
if err := r.emit(ctx, "/runtime/"+topic, &eventsapi.RuntimeEvent{
|
||||
ID: e.ID,
|
||||
Type: eventsapi.RuntimeEvent_EventType(e.Type),
|
||||
Pid: e.Pid,
|
||||
ExitStatus: e.ExitStatus,
|
||||
ExitedAt: e.ExitedAt,
|
||||
}); err != nil {
|
||||
r.events <- e
|
||||
if err := r.emit(ctx, "/runtime/"+getTopic(e), e); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getTopic(e *eventsapi.RuntimeEvent) string {
|
||||
switch e.Type {
|
||||
case eventsapi.RuntimeEvent_CREATE:
|
||||
return "task-create"
|
||||
case eventsapi.RuntimeEvent_START:
|
||||
return "task-start"
|
||||
case eventsapi.RuntimeEvent_EXEC_ADDED:
|
||||
return "task-execadded"
|
||||
case eventsapi.RuntimeEvent_OOM:
|
||||
return "task-oom"
|
||||
case eventsapi.RuntimeEvent_EXIT:
|
||||
return "task-exit"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (r *Runtime) terminate(ctx context.Context, bundle *bundle, ns, id string) error {
|
||||
ctx = namespaces.WithNamespace(ctx, ns)
|
||||
rt, err := r.getRuntime(ctx, ns, id)
|
||||
|
@ -5,6 +5,7 @@ package shim
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
events "github.com/containerd/containerd/api/services/events/v1"
|
||||
shimapi "github.com/containerd/containerd/linux/shim/v1"
|
||||
google_protobuf "github.com/golang/protobuf/ptypes/empty"
|
||||
"golang.org/x/net/context"
|
||||
@ -53,7 +54,7 @@ func (c *local) ResizePty(ctx context.Context, in *shimapi.ResizePtyRequest, opt
|
||||
}
|
||||
|
||||
func (c *local) Stream(ctx context.Context, in *shimapi.StreamEventsRequest, opts ...grpc.CallOption) (shimapi.Shim_StreamClient, error) {
|
||||
return &events{
|
||||
return &streamEvents{
|
||||
c: c.s.events,
|
||||
ctx: ctx,
|
||||
}, nil
|
||||
@ -95,36 +96,36 @@ func (c *local) Update(ctx context.Context, in *shimapi.UpdateTaskRequest, opts
|
||||
return c.s.Update(ctx, in)
|
||||
}
|
||||
|
||||
type events struct {
|
||||
c chan *shimapi.Event
|
||||
type streamEvents struct {
|
||||
c chan *events.RuntimeEvent
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (e *events) Recv() (*shimapi.Event, error) {
|
||||
func (e *streamEvents) Recv() (*events.RuntimeEvent, error) {
|
||||
ev := <-e.c
|
||||
return ev, nil
|
||||
}
|
||||
|
||||
func (e *events) Header() (metadata.MD, error) {
|
||||
func (e *streamEvents) Header() (metadata.MD, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (e *events) Trailer() metadata.MD {
|
||||
func (e *streamEvents) Trailer() metadata.MD {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *events) CloseSend() error {
|
||||
func (e *streamEvents) CloseSend() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *events) Context() context.Context {
|
||||
func (e *streamEvents) Context() context.Context {
|
||||
return e.ctx
|
||||
}
|
||||
|
||||
func (e *events) SendMsg(m interface{}) error {
|
||||
func (e *streamEvents) SendMsg(m interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *events) RecvMsg(m interface{}) error {
|
||||
func (e *streamEvents) RecvMsg(m interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/console"
|
||||
events "github.com/containerd/containerd/api/services/events/v1"
|
||||
"github.com/containerd/containerd/api/types/task"
|
||||
shimapi "github.com/containerd/containerd/linux/shim/v1"
|
||||
"github.com/containerd/containerd/reaper"
|
||||
@ -34,7 +35,7 @@ func NewService(path, namespace string) (*Service, error) {
|
||||
return &Service{
|
||||
path: path,
|
||||
processes: make(map[int]process),
|
||||
events: make(chan *shimapi.Event, 4096),
|
||||
events: make(chan *events.RuntimeEvent, 4096),
|
||||
namespace: namespace,
|
||||
}, nil
|
||||
}
|
||||
@ -46,9 +47,9 @@ type Service struct {
|
||||
bundle string
|
||||
mu sync.Mutex
|
||||
processes map[int]process
|
||||
events chan *shimapi.Event
|
||||
events chan *events.RuntimeEvent
|
||||
eventsMu sync.Mutex
|
||||
deferredEvent *shimapi.Event
|
||||
deferredEvent *events.RuntimeEvent
|
||||
execID int
|
||||
namespace string
|
||||
}
|
||||
@ -69,8 +70,8 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*sh
|
||||
ExitCh: make(chan int, 1),
|
||||
}
|
||||
reaper.Default.Register(pid, cmd)
|
||||
s.events <- &shimapi.Event{
|
||||
Type: shimapi.Event_CREATE,
|
||||
s.events <- &events.RuntimeEvent{
|
||||
Type: events.RuntimeEvent_CREATE,
|
||||
ID: r.ID,
|
||||
Pid: uint32(pid),
|
||||
}
|
||||
@ -87,8 +88,8 @@ func (s *Service) Start(ctx context.Context, r *google_protobuf.Empty) (*google_
|
||||
if err := s.initProcess.Start(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.events <- &shimapi.Event{
|
||||
Type: shimapi.Event_START,
|
||||
s.events <- &events.RuntimeEvent{
|
||||
Type: events.RuntimeEvent_START,
|
||||
ID: s.id,
|
||||
Pid: uint32(s.initProcess.Pid()),
|
||||
}
|
||||
@ -156,8 +157,8 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*shi
|
||||
reaper.Default.Register(pid, cmd)
|
||||
s.processes[pid] = process
|
||||
|
||||
s.events <- &shimapi.Event{
|
||||
Type: shimapi.Event_EXEC_ADDED,
|
||||
s.events <- &events.RuntimeEvent{
|
||||
Type: events.RuntimeEvent_EXEC_ADDED,
|
||||
ID: s.id,
|
||||
Pid: uint32(pid),
|
||||
}
|
||||
@ -379,8 +380,8 @@ func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) {
|
||||
p.Exited(status)
|
||||
|
||||
reaper.Default.Delete(pid)
|
||||
s.events <- &shimapi.Event{
|
||||
Type: shimapi.Event_EXIT,
|
||||
s.events <- &events.RuntimeEvent{
|
||||
Type: events.RuntimeEvent_EXIT,
|
||||
ID: s.id,
|
||||
Pid: uint32(pid),
|
||||
ExitStatus: uint32(status),
|
||||
|
@ -24,7 +24,6 @@
|
||||
CheckpointTaskRequest
|
||||
ShimInfoResponse
|
||||
StreamEventsRequest
|
||||
Event
|
||||
UpdateTaskRequest
|
||||
*/
|
||||
package shim
|
||||
@ -38,6 +37,7 @@ import _ "github.com/gogo/protobuf/gogoproto"
|
||||
import _ "github.com/gogo/protobuf/types"
|
||||
import containerd_types "github.com/containerd/containerd/api/types"
|
||||
import containerd_v1_types "github.com/containerd/containerd/api/types/task"
|
||||
import containerd_services_events_v1 "github.com/containerd/containerd/api/services/events/v1"
|
||||
|
||||
import time "time"
|
||||
|
||||
@ -66,39 +66,6 @@ var _ = time.Kitchen
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Event_EventType int32
|
||||
|
||||
const (
|
||||
Event_EXIT Event_EventType = 0
|
||||
Event_OOM Event_EventType = 1
|
||||
Event_CREATE Event_EventType = 2
|
||||
Event_START Event_EventType = 3
|
||||
Event_EXEC_ADDED Event_EventType = 4
|
||||
Event_PAUSED Event_EventType = 5
|
||||
)
|
||||
|
||||
var Event_EventType_name = map[int32]string{
|
||||
0: "EXIT",
|
||||
1: "OOM",
|
||||
2: "CREATE",
|
||||
3: "START",
|
||||
4: "EXEC_ADDED",
|
||||
5: "PAUSED",
|
||||
}
|
||||
var Event_EventType_value = map[string]int32{
|
||||
"EXIT": 0,
|
||||
"OOM": 1,
|
||||
"CREATE": 2,
|
||||
"START": 3,
|
||||
"EXEC_ADDED": 4,
|
||||
"PAUSED": 5,
|
||||
}
|
||||
|
||||
func (x Event_EventType) String() string {
|
||||
return proto.EnumName(Event_EventType_name, int32(x))
|
||||
}
|
||||
func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorShim, []int{15, 0} }
|
||||
|
||||
type CreateTaskRequest struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
|
||||
@ -247,25 +214,13 @@ func (m *StreamEventsRequest) Reset() { *m = StreamEventsRequ
|
||||
func (*StreamEventsRequest) ProtoMessage() {}
|
||||
func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} }
|
||||
|
||||
type Event struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Type Event_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.runtime.linux.shim.v1.Event_EventType" json:"type,omitempty"`
|
||||
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||
ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
|
||||
ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"`
|
||||
}
|
||||
|
||||
func (m *Event) Reset() { *m = Event{} }
|
||||
func (*Event) ProtoMessage() {}
|
||||
func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} }
|
||||
|
||||
type UpdateTaskRequest struct {
|
||||
Resources *google_protobuf.Any `protobuf:"bytes,1,opt,name=resources" json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} }
|
||||
func (*UpdateTaskRequest) ProtoMessage() {}
|
||||
func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} }
|
||||
func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*CreateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CreateTaskRequest")
|
||||
@ -283,9 +238,7 @@ func init() {
|
||||
proto.RegisterType((*CheckpointTaskRequest)(nil), "containerd.runtime.linux.shim.v1.CheckpointTaskRequest")
|
||||
proto.RegisterType((*ShimInfoResponse)(nil), "containerd.runtime.linux.shim.v1.ShimInfoResponse")
|
||||
proto.RegisterType((*StreamEventsRequest)(nil), "containerd.runtime.linux.shim.v1.StreamEventsRequest")
|
||||
proto.RegisterType((*Event)(nil), "containerd.runtime.linux.shim.v1.Event")
|
||||
proto.RegisterType((*UpdateTaskRequest)(nil), "containerd.runtime.linux.shim.v1.UpdateTaskRequest")
|
||||
proto.RegisterEnum("containerd.runtime.linux.shim.v1.Event_EventType", Event_EventType_name, Event_EventType_value)
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -424,7 +377,7 @@ func (c *shimClient) Stream(ctx context.Context, in *StreamEventsRequest, opts .
|
||||
}
|
||||
|
||||
type Shim_StreamClient interface {
|
||||
Recv() (*Event, error)
|
||||
Recv() (*containerd_services_events_v1.RuntimeEvent, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
@ -432,8 +385,8 @@ type shimStreamClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *shimStreamClient) Recv() (*Event, error) {
|
||||
m := new(Event)
|
||||
func (x *shimStreamClient) Recv() (*containerd_services_events_v1.RuntimeEvent, error) {
|
||||
m := new(containerd_services_events_v1.RuntimeEvent)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -692,7 +645,7 @@ func _Shim_Stream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
}
|
||||
|
||||
type Shim_StreamServer interface {
|
||||
Send(*Event) error
|
||||
Send(*containerd_services_events_v1.RuntimeEvent) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
@ -700,7 +653,7 @@ type shimStreamServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *shimStreamServer) Send(m *Event) error {
|
||||
func (x *shimStreamServer) Send(m *containerd_services_events_v1.RuntimeEvent) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
@ -1456,53 +1409,6 @@ func (m *StreamEventsRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *Event) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Event) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.ID) > 0 {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(len(m.ID)))
|
||||
i += copy(dAtA[i:], m.ID)
|
||||
}
|
||||
if m.Type != 0 {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(m.Type))
|
||||
}
|
||||
if m.Pid != 0 {
|
||||
dAtA[i] = 0x18
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(m.Pid))
|
||||
}
|
||||
if m.ExitStatus != 0 {
|
||||
dAtA[i] = 0x20
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(m.ExitStatus))
|
||||
}
|
||||
dAtA[i] = 0x2a
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt)))
|
||||
n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n3
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *UpdateTaskRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@ -1522,11 +1428,11 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(m.Resources.Size()))
|
||||
n4, err := m.Resources.MarshalTo(dAtA[i:])
|
||||
n3, err := m.Resources.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n4
|
||||
i += n3
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
@ -1809,27 +1715,6 @@ func (m *StreamEventsRequest) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Event) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.ID)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovShim(uint64(l))
|
||||
}
|
||||
if m.Type != 0 {
|
||||
n += 1 + sovShim(uint64(m.Type))
|
||||
}
|
||||
if m.Pid != 0 {
|
||||
n += 1 + sovShim(uint64(m.Pid))
|
||||
}
|
||||
if m.ExitStatus != 0 {
|
||||
n += 1 + sovShim(uint64(m.ExitStatus))
|
||||
}
|
||||
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt)
|
||||
n += 1 + l + sovShim(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *UpdateTaskRequest) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
@ -2041,20 +1926,6 @@ func (this *StreamEventsRequest) String() string {
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *Event) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&Event{`,
|
||||
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
|
||||
`Type:` + fmt.Sprintf("%v", this.Type) + `,`,
|
||||
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
||||
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
|
||||
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf3.Timestamp", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *UpdateTaskRequest) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
@ -3983,172 +3854,6 @@ func (m *StreamEventsRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Event) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowShim
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Event: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowShim
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthShim
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ID = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
|
||||
}
|
||||
m.Type = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowShim
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Type |= (Event_EventType(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
|
||||
}
|
||||
m.Pid = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowShim
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Pid |= (uint32(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType)
|
||||
}
|
||||
m.ExitStatus = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowShim
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.ExitStatus |= (uint32(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 5:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowShim
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthShim
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipShim(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthShim
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *UpdateTaskRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
@ -4342,82 +4047,77 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptorShim = []byte{
|
||||
// 1224 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0xe3, 0xc4,
|
||||
0x17, 0xaf, 0xf3, 0xc3, 0x49, 0x5e, 0xbe, 0xa9, 0xb2, 0xb3, 0xdd, 0x7e, 0xb3, 0x59, 0x94, 0x56,
|
||||
0x3e, 0xb0, 0x95, 0xd0, 0x3a, 0xdb, 0x94, 0xdd, 0x96, 0x72, 0x4a, 0x1b, 0x0b, 0x55, 0x50, 0x35,
|
||||
0x4c, 0x52, 0x58, 0x21, 0x41, 0xe5, 0x26, 0xd3, 0xc4, 0x34, 0xb1, 0x8d, 0x67, 0x5c, 0x1a, 0x4e,
|
||||
0x7b, 0xe2, 0xcc, 0x9f, 0xc0, 0x81, 0x3b, 0x47, 0x4e, 0x9c, 0xe9, 0x91, 0x23, 0xa7, 0x85, 0xed,
|
||||
0x5f, 0x82, 0x66, 0x6c, 0xc7, 0x4e, 0x52, 0x6f, 0x92, 0x8a, 0x4b, 0x3c, 0x6f, 0xe6, 0xbd, 0x99,
|
||||
0x37, 0x9f, 0xf7, 0xde, 0xe7, 0x4d, 0xe0, 0xa3, 0x9e, 0xc1, 0xfa, 0xee, 0xb9, 0xda, 0xb1, 0x86,
|
||||
0xd5, 0x8e, 0x65, 0x32, 0xdd, 0x30, 0x89, 0xd3, 0x8d, 0x0e, 0x07, 0x86, 0xe9, 0x5e, 0x57, 0x69,
|
||||
0xdf, 0x18, 0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, 0x24, 0x4f,
|
||||
0x01, 0xfb, 0x12, 0xc7, 0x42, 0x1f, 0x0c, 0x04, 0x40, 0x59, 0xcc, 0x87, 0xb3, 0xe8, 0x28, 0x7b,
|
||||
0xb0, 0x7a, 0x38, 0xb0, 0x28, 0x39, 0x3a, 0x79, 0x67, 0x0c, 0xc3, 0x14, 0xcc, 0xfa, 0x17, 0x52,
|
||||
0x54, 0x58, 0xfb, 0xcc, 0xa0, 0xac, 0x19, 0xdc, 0x7b, 0x0e, 0xd1, 0x29, 0x2d, 0x78, 0x34, 0xa5,
|
||||
0xef, 0x87, 0x78, 0x02, 0x6b, 0x69, 0x29, 0xac, 0x95, 0x3f, 0x24, 0x78, 0x14, 0x52, 0x47, 0x94,
|
||||
0x6f, 0x11, 0xa4, 0x6c, 0x9d, 0xf5, 0x3d, 0x47, 0xb0, 0x18, 0xa3, 0x6f, 0x20, 0x63, 0xd9, 0xcc,
|
||||
0xb0, 0x4c, 0x4e, 0x04, 0xfc, 0x9c, 0x86, 0x3a, 0xaf, 0x61, 0xa9, 0x77, 0xee, 0xae, 0x9e, 0x78,
|
||||
0xdb, 0x68, 0x26, 0x73, 0x46, 0x38, 0xd8, 0xb4, 0xbc, 0x0f, 0xff, 0x8b, 0x2e, 0x70, 0x28, 0x2f,
|
||||
0xc9, 0xc8, 0x77, 0x81, 0x0f, 0x39, 0x94, 0x57, 0xfa, 0xc0, 0x0d, 0xb2, 0xd6, 0x13, 0xf6, 0x13,
|
||||
0x7b, 0x92, 0xf2, 0x0c, 0x8a, 0xad, 0xbe, 0x31, 0x3c, 0x32, 0x2f, 0xac, 0x31, 0x32, 0x8f, 0x21,
|
||||
0xcb, 0xdd, 0x38, 0x0b, 0xe3, 0x91, 0xe1, 0x72, 0xd3, 0xe8, 0x2a, 0x8f, 0xe0, 0x61, 0x8b, 0x39,
|
||||
0x44, 0x1f, 0x6a, 0x57, 0xc4, 0x64, 0x01, 0xf8, 0xca, 0xaf, 0x09, 0x48, 0x8b, 0x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0x5f, 0x6f, 0x2b, 0x2b, 0xaf, 0x6f,
|
||||
0x2b, 0xd2, 0xcd, 0x6d, 0x45, 0xfa, 0xf3, 0xb6, 0x22, 0xfd, 0x73, 0x5b, 0x91, 0xbe, 0xda, 0x59,
|
||||
0xee, 0xaf, 0xf0, 0xc7, 0xfc, 0x7b, 0x2e, 0x8b, 0xed, 0x77, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff,
|
||||
0x94, 0x4d, 0x29, 0x2c, 0x48, 0x0f, 0x00, 0x00,
|
||||
// 1143 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6e, 0xdb, 0xc6,
|
||||
0x13, 0x0f, 0x65, 0x99, 0x96, 0x46, 0x7f, 0x19, 0xf6, 0xc6, 0xf6, 0x9f, 0x51, 0x0a, 0xd9, 0xe0,
|
||||
0xa1, 0x35, 0x10, 0x84, 0x8c, 0xe5, 0x26, 0x76, 0xdd, 0x93, 0xbf, 0x50, 0x18, 0xad, 0x11, 0x81,
|
||||
0x4e, 0x5a, 0xa0, 0x40, 0x6b, 0xd0, 0xd2, 0x5a, 0x5a, 0x98, 0x22, 0x59, 0xee, 0x52, 0xb5, 0x7a,
|
||||
0xca, 0xa9, 0xe7, 0x3e, 0x42, 0x0f, 0x7d, 0x8b, 0xa2, 0xe7, 0xfa, 0xd8, 0x63, 0x4f, 0x69, 0xe3,
|
||||
0x27, 0x29, 0xf6, 0x83, 0x26, 0x25, 0x99, 0x95, 0x14, 0xf4, 0x22, 0xee, 0xec, 0xce, 0xcc, 0xce,
|
||||
0xfc, 0xe6, 0x6b, 0x05, 0x9f, 0x74, 0x08, 0xeb, 0xc6, 0x17, 0x56, 0x2b, 0xe8, 0xd9, 0xad, 0xc0,
|
||||
0x67, 0x2e, 0xf1, 0x71, 0xd4, 0xce, 0x2e, 0x3d, 0xe2, 0xc7, 0xd7, 0x36,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c4, 0x41, 0x42, 0x22, 0x1b, 0xf4,
|
||||
0x28, 0x08, 0xd8, 0x25, 0x35, 0x8a, 0x1b, 0x73, 0x9b, 0x95, 0xc6, 0xff, 0xad, 0x4c, 0xf0, 0x84,
|
||||
0x67, 0xd6, 0x29, 0x47, 0xc4, 0x51, 0x6c, 0xa8, 0x06, 0x25, 0x86, 0xa3, 0x1e, 0xf1, 0x5d, 0xcf,
|
||||
0x98, 0xdf, 0xd0, 0x36, 0x4b, 0xce, 0x1d, 0x8d, 0x56, 0x60, 0x9e, 0xb2, 0x36, 0xf1, 0x0d, 0x5d,
|
||||
0x5c, 0x22, 0x09, 0x6e, 0x14, 0x65, 0xed, 0x20, 0x66, 0xc6, 0x82, 0x34, 0x4a, 0x52, 0x6a, 0x1f,
|
||||
0x47, 0x91, 0x51, 0xba, 0xdb, 0xc7, 0x51, 0x84, 0xea, 0x00, 0xad, 0x2e, 0x6e, 0x5d, 0x85, 0x01,
|
||||
0xf1, 0x99, 0x51, 0x16, 0x67, 0x99, 0x1d, 0xf4, 0x04, 0x96, 0x43, 0x37, 0xc2, 0x3e, 0x3b, 0xcf,
|
||||
0xb0, 0x81, 0x60, 0x5b, 0x92, 0x07, 0x87, 0x77, 0xfb, 0xe6, 0x87, 0x80, 0xb2, 0xf0, 0xd1, 0x30,
|
||||
0xf0, 0x29, 0x46, 0x4b, 0x30, 0x17, 0x2a, 0x00, 0xab, 0x0e, 0x5f, 0x9a, 0x3f, 0x6a, 0xb0, 0x78,
|
||||
0x84, 0x3d, 0xcc, 0x70, 0x3e, 0x13, 0x5a, 0x87, 0x0a, 0xbe, 0x26, 0xec, 0x9c, 0x32, 0x97, 0xc5,
|
||||
0x54, 0x60, 0x5c, 0x75, 0x80, 0x6f, 0x9d, 0x89, 0x1d, 0xb4, 0x0f, 0x65, 0x4e, 0xe1, 0xf6, 0xb9,
|
||||
0xcb, 0x04, 0xd2, 0x95, 0x46, 0xcd, 0x92, 0xd9, 0x69, 0x25, 0xd9, 0x69, 0xbd, 0x4a, 0xb2, 0xf3,
|
||||
0xa0, 0x74, 0xf3, 0x76, 0xfd, 0xc1, 0x4f, 0x7f, 0xad, 0x6b, 0x4e, 0x49, 0x8a, 0xed, 0x33, 0x73,
|
||||
0x13, 0x56, 0xa4, 0x1d, 0xcd, 0x28, 0x68, 0x61, 0x4a, 0x93, 0x90, 0x8f, 0x9b, 0xfc, 0xb3, 0x06,
|
||||
0xe8, 0xf8, 0x1a, 0xb7, 0x46, 0x18, 0xb3, 0x01, 0xd2, 0xf2, 0x02, 0x54, 0xb8, 0x3f, 0x40, 0x73,
|
||||
0x39, 0x01, 0x2a, 0x0e, 0x05, 0x68, 0x13, 0x8a, 0x34, 0xc4, 0x2d, 0x11, 0xfe, 0x4a, 0x63, 0x65,
|
||||
0xcc, 0xc1, 0x7d, 0x7f, 0xe0, 0x08, 0x0e, 0xf3, 0x23, 0x78, 0x38, 0x64, 0x61, 0x2e, 0xfc, 0x0e,
|
||||
0x2c, 0x39, 0x98, 0x92, 0x1f, 0x70, 0x93, 0x0d, 0x72, 0x3d, 0xe6, 0xe6, 0x7f, 0x4f, 0xda, 0xac,
|
||||
0xab, 0x90, 0x97, 0x04, 0x37, 0xb3, 0x8b, 0x49, 0xa7, 0x2b, 0xcd, 0xaf, 0x3a, 0x8a, 0x32, 0x7f,
|
||||
0x29, 0x40, 0x95, 0xc7, 0x25, 0x8d, 0xe8, 0xac, 0x65, 0xa3, 0x2c, 0x98, 0x4b, 0x2d, 0xd8, 0xe6,
|
||||
0x90, 0x88, 0xe0, 0x73, 0x48, 0x16, 0x1b, 0x8f, 0xb3, 0xe5, 0xd2, 0xdf, 0x52, 0x15, 0x23, 0xb3,
|
||||
0xc1, 0x51, 0xac, 0x68, 0x0f, 0xca, 0xa1, 0x44, 0x00, 0x53, 0x63, 0x5e, 0x94, 0xd9, 0x07, 0xf7,
|
||||
0xca, 0x25, 0x38, 0xa5, 0xec, 0xff, 0x51, 0x49, 0x65, 0x73, 0xa2, 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 0x78, 0xc6, 0x22, 0xec, 0xf6, 0x8e, 0xc5,
|
||||
0x14, 0x52, 0x76, 0x99, 0x9f, 0xc1, 0xf2, 0xeb, 0xb0, 0x3d, 0x32, 0x7a, 0x1a, 0x50, 0x8e, 0x30,
|
||||
0x0d, 0xe2, 0xa8, 0x25, 0x00, 0xce, 0xef, 0x00, 0x29, 0x5b, 0xe3, 0xd7, 0x0a, 0x14, 0xb9, 0x3d,
|
||||
0xa8, 0x09, 0xf3, 0xa2, 0x22, 0xd1, 0xda, 0x98, 0xc8, 0x31, 0x1f, 0xf3, 0x35, 0x7b, 0x32, 0x86,
|
||||
0xc3, 0x25, 0x4d, 0x41, 0x97, 0xfd, 0x1d, 0x6d, 0x4f, 0x01, 0xff, 0xe8, 0x20, 0xad, 0x7d, 0x3c,
|
||||
0x9b, 0x90, 0xba, 0x74, 0x47, 0xb8, 0x11, 0xb1, 0x5c, 0x37, 0x72, 0xf6, 0x91, 0x03, 0xba, 0x6c,
|
||||
0xee, 0xb9, 0x92, 0xcf, 0x26, 0x1b, 0x34, 0x32, 0xa6, 0x06, 0x50, 0x1d, 0x1a, 0x18, 0xe8, 0xc5,
|
||||
0xb4, 0x2a, 0x86, 0x07, 0xc7, 0x7b, 0x5c, 0xfd, 0x46, 0x83, 0xea, 0x50, 0x19, 0x4e, 0x73, 0xf7,
|
||||
0x7d, 0x75, 0x5e, 0xdb, 0x99, 0x59, 0x2e, 0x0d, 0x45, 0xd3, 0x8d, 0x29, 0x9e, 0x39, 0x14, 0xbb,
|
||||
0xa0, 0x3b, 0x98, 0xc6, 0xbd, 0xd9, 0x25, 0xbf, 0x01, 0x48, 0xeb, 0x18, 0xed, 0xbc, 0x67, 0xd5,
|
||||
0xe7, 0xaa, 0xf7, 0x41, 0x97, 0xc5, 0x88, 0x9e, 0x4f, 0x53, 0x0c, 0x63, 0x65, 0x5b, 0x7b, 0x92,
|
||||
0x15, 0x4b, 0x1e, 0x98, 0x96, 0x7c, 0x60, 0x72, 0x19, 0x47, 0x6a, 0x12, 0x42, 0xcf, 0x34, 0x74,
|
||||
0x0a, 0x45, 0xde, 0xff, 0xd1, 0xd3, 0xc9, 0xb7, 0x65, 0xe6, 0x44, 0xae, 0xf9, 0x14, 0x8a, 0x7c,
|
||||
0xe4, 0xa3, 0x29, 0x2a, 0x6b, 0xfc, 0xf1, 0x52, 0x7b, 0x3e, 0xa3, 0x94, 0xca, 0x82, 0xaf, 0xa0,
|
||||
0x7c, 0xf7, 0x7c, 0x40, 0x8d, 0xc9, 0x3a, 0x46, 0xdf, 0x1a, 0xb9, 0xde, 0x9c, 0xc1, 0x82, 0x9a,
|
||||
0x68, 0x68, 0x8a, 0xf2, 0x18, 0x1e, 0x7e, 0xb9, 0x4a, 0xbf, 0x84, 0x52, 0xd2, 0x9d, 0x73, 0x93,
|
||||
0x6f, 0x0a, 0x27, 0xc6, 0x3a, 0xfc, 0x6b, 0xd0, 0x65, 0xbf, 0x9e, 0xa6, 0x17, 0x8e, 0x75, 0xf6,
|
||||
0x3c, 0x73, 0x0f, 0x4e, 0x6f, 0xde, 0xd5, 0x1f, 0xfc, 0xf9, 0xae, 0xfe, 0xe0, 0xcd, 0x6d, 0x5d,
|
||||
0xbb, 0xb9, 0xad, 0x6b, 0x7f, 0xdc, 0xd6, 0xb5, 0xbf, 0x6f, 0xeb, 0xda, 0xd7, 0xdb, 0xb3, 0xfd,
|
||||
0x47, 0xfc, 0x94, 0x7f, 0x2f, 0x74, 0xa1, 0x7e, 0xfb, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5e,
|
||||
0x29, 0xea, 0xb4, 0x61, 0x0e, 0x00, 0x00,
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "github.com/containerd/containerd/api/types/mount.proto";
|
||||
import "github.com/containerd/containerd/api/types/task/task.proto";
|
||||
import "github.com/containerd/containerd/api/services/events/v1/runtime.proto";
|
||||
|
||||
option go_package = "github.com/containerd/containerd/linux/shim/v1;shim";
|
||||
|
||||
@ -35,7 +36,7 @@ service Shim {
|
||||
|
||||
rpc Checkpoint(CheckpointTaskRequest) returns (google.protobuf.Empty);
|
||||
|
||||
rpc Stream(StreamEventsRequest) returns (stream Event);
|
||||
rpc Stream(StreamEventsRequest) returns (stream containerd.services.events.v1.RuntimeEvent);
|
||||
|
||||
rpc Kill(KillRequest) returns (google.protobuf.Empty);
|
||||
|
||||
@ -139,24 +140,6 @@ message ShimInfoResponse {
|
||||
message StreamEventsRequest {
|
||||
}
|
||||
|
||||
message Event {
|
||||
string id = 1;
|
||||
|
||||
enum EventType {
|
||||
EXIT = 0;
|
||||
OOM = 1;
|
||||
CREATE = 2;
|
||||
START = 3;
|
||||
EXEC_ADDED = 4;
|
||||
PAUSED = 5;
|
||||
}
|
||||
|
||||
EventType type = 2;
|
||||
uint32 pid = 3;
|
||||
uint32 exit_status = 4;
|
||||
google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message UpdateTaskRequest {
|
||||
google.protobuf.Any resources = 1;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
events "github.com/containerd/containerd/api/services/events/v1"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
@ -41,7 +42,7 @@ type cgroupsMonitor struct {
|
||||
collector *Collector
|
||||
oom *OOMCollector
|
||||
context context.Context
|
||||
events chan<- *runtime.Event
|
||||
events chan<- *events.RuntimeEvent
|
||||
}
|
||||
|
||||
func (m *cgroupsMonitor) Monitor(c runtime.Task) error {
|
||||
@ -66,14 +67,14 @@ func (m *cgroupsMonitor) Stop(c runtime.Task) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *cgroupsMonitor) Events(events chan<- *runtime.Event) {
|
||||
func (m *cgroupsMonitor) Events(events chan<- *events.RuntimeEvent) {
|
||||
m.events = events
|
||||
}
|
||||
|
||||
func (m *cgroupsMonitor) trigger(id string, cg cgroups.Cgroup) {
|
||||
m.events <- &runtime.Event{
|
||||
m.events <- &events.RuntimeEvent{
|
||||
Timestamp: time.Now(),
|
||||
Type: runtime.OOMEvent,
|
||||
Type: events.RuntimeEvent_OOM,
|
||||
ID: id,
|
||||
}
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
package runtime
|
||||
|
||||
import "time"
|
||||
|
||||
type EventType int
|
||||
|
||||
func (t EventType) String() string {
|
||||
switch t {
|
||||
case ExitEvent:
|
||||
return "exit"
|
||||
case PausedEvent:
|
||||
return "paused"
|
||||
case CreateEvent:
|
||||
return "create"
|
||||
case StartEvent:
|
||||
return "start"
|
||||
case OOMEvent:
|
||||
return "oom"
|
||||
case ExecAddEvent:
|
||||
return "execAdd"
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
const (
|
||||
ExitEvent EventType = iota + 1
|
||||
PausedEvent
|
||||
CreateEvent
|
||||
StartEvent
|
||||
OOMEvent
|
||||
ExecAddEvent
|
||||
)
|
||||
|
||||
type Event struct {
|
||||
Timestamp time.Time
|
||||
Type EventType
|
||||
Runtime string
|
||||
ID string
|
||||
Pid uint32
|
||||
ExitStatus uint32
|
||||
ExitedAt time.Time
|
||||
}
|
@ -1,13 +1,15 @@
|
||||
package runtime
|
||||
|
||||
import events "github.com/containerd/containerd/api/services/events/v1"
|
||||
|
||||
// TaskMonitor provides an interface for monitoring of containers within containerd
|
||||
type TaskMonitor interface {
|
||||
// Monitor adds the provided container to the monitor
|
||||
Monitor(Task) error
|
||||
// Stop stops and removes the provided container from the monitor
|
||||
Stop(Task) error
|
||||
// Events emits events from the monitor
|
||||
Events(chan<- *Event)
|
||||
// Events emits events to the channel for the monitor
|
||||
Events(chan<- *events.RuntimeEvent)
|
||||
}
|
||||
|
||||
func NewMultiTaskMonitor(monitors ...TaskMonitor) TaskMonitor {
|
||||
@ -31,7 +33,7 @@ func (mm *noopTaskMonitor) Stop(c Task) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mm *noopTaskMonitor) Events(events chan<- *Event) {
|
||||
func (mm *noopTaskMonitor) Events(events chan<- *events.RuntimeEvent) {
|
||||
}
|
||||
|
||||
type multiTaskMonitor struct {
|
||||
@ -56,7 +58,7 @@ func (mm *multiTaskMonitor) Stop(c Task) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mm *multiTaskMonitor) Events(events chan<- *Event) {
|
||||
func (mm *multiTaskMonitor) Events(events chan<- *events.RuntimeEvent) {
|
||||
for _, m := range mm.monitors {
|
||||
m.Events(events)
|
||||
}
|
||||
|
@ -9,8 +9,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
events "github.com/containerd/containerd/api/services/events/v1"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
"github.com/containerd/containerd/windows/hcs"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
@ -19,7 +20,7 @@ import (
|
||||
|
||||
var ErrLoadedContainer = errors.New("loaded container can only be terminated")
|
||||
|
||||
type eventCallback func(id string, evType plugin.EventType, pid, exitStatus uint32, exitedAt time.Time)
|
||||
type eventCallback func(id string, evType events.RuntimeEvent_EventType, pid, exitStatus uint32, exitedAt time.Time)
|
||||
|
||||
func loadContainers(ctx context.Context, h *hcs.HCS, sendEvent eventCallback) ([]*container, error) {
|
||||
hCtr, err := h.LoadContainers(ctx)
|
||||
@ -31,7 +32,7 @@ func loadContainers(ctx context.Context, h *hcs.HCS, sendEvent eventCallback) ([
|
||||
for _, c := range hCtr {
|
||||
containers = append(containers, &container{
|
||||
ctr: c,
|
||||
status: plugin.RunningStatus,
|
||||
status: runtime.RunningStatus,
|
||||
sendEvent: sendEvent,
|
||||
})
|
||||
}
|
||||
@ -39,7 +40,7 @@ func loadContainers(ctx context.Context, h *hcs.HCS, sendEvent eventCallback) ([
|
||||
return containers, nil
|
||||
}
|
||||
|
||||
func newContainer(ctx context.Context, h *hcs.HCS, id string, spec RuntimeSpec, io plugin.IO, sendEvent eventCallback) (*container, error) {
|
||||
func newContainer(ctx context.Context, h *hcs.HCS, id string, spec RuntimeSpec, io runtime.IO, sendEvent eventCallback) (*container, error) {
|
||||
cio, err := hcs.NewIO(io.Stdin, io.Stdout, io.Stderr, io.Terminal)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -49,11 +50,11 @@ func newContainer(ctx context.Context, h *hcs.HCS, id string, spec RuntimeSpec,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sendEvent(id, plugin.CreateEvent, hcsCtr.Pid(), 0, time.Time{})
|
||||
sendEvent(id, events.RuntimeEvent_CREATE, hcsCtr.Pid(), 0, time.Time{})
|
||||
|
||||
return &container{
|
||||
ctr: hcsCtr,
|
||||
status: plugin.CreatedStatus,
|
||||
status: runtime.CreatedStatus,
|
||||
sendEvent: sendEvent,
|
||||
}, nil
|
||||
}
|
||||
@ -62,12 +63,12 @@ type container struct {
|
||||
sync.Mutex
|
||||
|
||||
ctr *hcs.Container
|
||||
status plugin.Status
|
||||
status runtime.Status
|
||||
sendEvent eventCallback
|
||||
}
|
||||
|
||||
func (c *container) Info() plugin.TaskInfo {
|
||||
return plugin.TaskInfo{
|
||||
func (c *container) Info() runtime.TaskInfo {
|
||||
return runtime.TaskInfo{
|
||||
ID: c.ctr.ID(),
|
||||
Runtime: runtimeName,
|
||||
}
|
||||
@ -83,8 +84,8 @@ func (c *container) Start(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
c.setStatus(plugin.RunningStatus)
|
||||
c.sendEvent(c.ctr.ID(), plugin.StartEvent, c.ctr.Pid(), 0, time.Time{})
|
||||
c.setStatus(runtime.RunningStatus)
|
||||
c.sendEvent(c.ctr.ID(), events.RuntimeEvent_START, c.ctr.Pid(), 0, time.Time{})
|
||||
|
||||
// Wait for our process to terminate
|
||||
go func() {
|
||||
@ -92,8 +93,8 @@ func (c *container) Start(ctx context.Context) error {
|
||||
if err != nil {
|
||||
log.G(ctx).Debug(err)
|
||||
}
|
||||
c.setStatus(plugin.StoppedStatus)
|
||||
c.sendEvent(c.ctr.ID(), plugin.ExitEvent, c.ctr.Pid(), ec, c.ctr.Processes()[0].ExitedAt())
|
||||
c.setStatus(runtime.StoppedStatus)
|
||||
c.sendEvent(c.ctr.ID(), events.RuntimeEvent_EXIT, c.ctr.Pid(), ec, c.ctr.Processes()[0].ExitedAt())
|
||||
}()
|
||||
|
||||
return nil
|
||||
@ -113,8 +114,8 @@ func (c *container) Resume(ctx context.Context) error {
|
||||
return c.ctr.Resume()
|
||||
}
|
||||
|
||||
func (c *container) State(ctx context.Context) (plugin.State, error) {
|
||||
return plugin.State{
|
||||
func (c *container) State(ctx context.Context) (runtime.State, error) {
|
||||
return runtime.State{
|
||||
Pid: c.Pid(),
|
||||
Status: c.Status(),
|
||||
}, nil
|
||||
@ -127,7 +128,7 @@ func (c *container) Kill(ctx context.Context, signal uint32, pid uint32, all boo
|
||||
return c.ctr.Stop(ctx)
|
||||
}
|
||||
|
||||
func (c *container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Process, error) {
|
||||
func (c *container) Exec(ctx context.Context, opts runtime.ExecOpts) (runtime.Process, error) {
|
||||
if c.ctr.Pid() == 0 {
|
||||
return nil, ErrLoadedContainer
|
||||
}
|
||||
@ -152,7 +153,7 @@ func (c *container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Proc
|
||||
if err != nil {
|
||||
log.G(ctx).Debug(err)
|
||||
}
|
||||
c.sendEvent(c.ctr.ID(), plugin.ExitEvent, p.Pid(), ec, p.ExitedAt())
|
||||
c.sendEvent(c.ctr.ID(), events.RuntimeEvent_EXEC_ADDED, p.Pid(), ec, p.ExitedAt())
|
||||
}()
|
||||
|
||||
return &process{p}, nil
|
||||
@ -162,11 +163,11 @@ func (c *container) CloseIO(ctx context.Context, pid uint32) error {
|
||||
return c.ctr.CloseIO(ctx, pid)
|
||||
}
|
||||
|
||||
func (c *container) ResizePty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error {
|
||||
func (c *container) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSize) error {
|
||||
return c.ctr.ResizePty(ctx, pid, size)
|
||||
}
|
||||
|
||||
func (c *container) Status() plugin.Status {
|
||||
func (c *container) Status() runtime.Status {
|
||||
return c.getStatus()
|
||||
}
|
||||
|
||||
@ -192,7 +193,7 @@ func (c *container) Checkpoint(ctx context.Context, _ string, _ map[string]strin
|
||||
return fmt.Errorf("Windows containers do not support checkpoint")
|
||||
}
|
||||
|
||||
func (c *container) DeleteProcess(ctx context.Context, pid uint32) (*plugin.Exit, error) {
|
||||
func (c *container) DeleteProcess(ctx context.Context, pid uint32) (*runtime.Exit, error) {
|
||||
var process *hcs.Process
|
||||
for _, p := range c.ctr.Processes() {
|
||||
if p.Pid() == pid {
|
||||
@ -208,7 +209,7 @@ func (c *container) DeleteProcess(ctx context.Context, pid uint32) (*plugin.Exit
|
||||
return nil, err
|
||||
}
|
||||
process.Delete()
|
||||
return &plugin.Exit{
|
||||
return &runtime.Exit{
|
||||
Status: ec,
|
||||
Timestamp: process.ExitedAt(),
|
||||
}, nil
|
||||
@ -218,13 +219,13 @@ func (c *container) Update(ctx context.Context, spec []byte) error {
|
||||
return fmt.Errorf("Windows containers do not support update")
|
||||
}
|
||||
|
||||
func (c *container) setStatus(status plugin.Status) {
|
||||
func (c *container) setStatus(status runtime.Status) {
|
||||
c.Lock()
|
||||
c.status = status
|
||||
c.Unlock()
|
||||
}
|
||||
|
||||
func (c *container) getStatus() plugin.Status {
|
||||
func (c *container) getStatus() runtime.Status {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
return c.status
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
"github.com/containerd/containerd/windows/pid"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
@ -216,7 +216,7 @@ func (c *Container) CloseIO(ctx context.Context, pid uint32) error {
|
||||
return proc.CloseStdin()
|
||||
}
|
||||
|
||||
func (c *Container) ResizePty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error {
|
||||
func (c *Container) ResizePty(ctx context.Context, pid uint32, size runtime.ConsoleSize) error {
|
||||
var proc *Process
|
||||
c.Lock()
|
||||
for _, p := range c.processes {
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -35,14 +35,14 @@ func (p *Process) ExitedAt() time.Time {
|
||||
return p.exitedAt
|
||||
}
|
||||
|
||||
func (p *Process) Status() plugin.Status {
|
||||
func (p *Process) Status() runtime.Status {
|
||||
select {
|
||||
case <-p.ecSync:
|
||||
return plugin.StoppedStatus
|
||||
return runtime.StoppedStatus
|
||||
default:
|
||||
}
|
||||
|
||||
return plugin.RunningStatus
|
||||
return runtime.RunningStatus
|
||||
}
|
||||
|
||||
func (p *Process) Delete() error {
|
||||
|
@ -5,7 +5,7 @@ package windows
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
"github.com/containerd/containerd/windows/hcs"
|
||||
)
|
||||
|
||||
@ -14,8 +14,8 @@ type process struct {
|
||||
*hcs.Process
|
||||
}
|
||||
|
||||
func (p *process) State(ctx context.Context) (plugin.State, error) {
|
||||
return plugin.State{
|
||||
func (p *process) State(ctx context.Context) (runtime.State, error) {
|
||||
return runtime.State{
|
||||
Pid: p.Pid(),
|
||||
Status: p.Status(),
|
||||
}, nil
|
||||
@ -25,7 +25,7 @@ func (p *process) Kill(ctx context.Context, sig uint32, all bool) error {
|
||||
return p.Process.Kill()
|
||||
}
|
||||
|
||||
func (p *process) Status() plugin.Status {
|
||||
func (p *process) Status() runtime.Status {
|
||||
return p.Process.Status()
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
events "github.com/containerd/containerd/api/services/events/v1"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
"github.com/containerd/containerd/windows/hcs"
|
||||
"github.com/containerd/containerd/windows/pid"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
@ -24,7 +26,7 @@ const (
|
||||
owner = "containerd"
|
||||
)
|
||||
|
||||
var _ = (plugin.Runtime)(&Runtime{})
|
||||
var _ = (runtime.Runtime)(&Runtime{})
|
||||
|
||||
func init() {
|
||||
plugin.Register(&plugin.Registration{
|
||||
@ -44,7 +46,7 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
r := &Runtime{
|
||||
pidPool: pid.NewPool(),
|
||||
containers: make(map[string]*container),
|
||||
events: make(chan *plugin.Event, 2048),
|
||||
events: make(chan *events.RuntimeEvent, 2048),
|
||||
eventsContext: c,
|
||||
eventsCancel: cancel,
|
||||
rootDir: rootDir,
|
||||
@ -60,7 +62,7 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
|
||||
for _, c := range ctrs {
|
||||
c.ctr.Delete(ic.Context)
|
||||
r.sendEvent(c.ctr.ID(), plugin.ExitEvent, c.ctr.Pid(), 255, time.Time{})
|
||||
r.sendEvent(c.ctr.ID(), events.RuntimeEvent_EXIT, c.ctr.Pid(), 255, time.Time{})
|
||||
}
|
||||
|
||||
// Try to delete the old state dir and recreate it
|
||||
@ -87,7 +89,7 @@ type Runtime struct {
|
||||
|
||||
containers map[string]*container
|
||||
|
||||
events chan *plugin.Event
|
||||
events chan *events.RuntimeEvent
|
||||
eventsContext context.Context
|
||||
eventsCancel func()
|
||||
}
|
||||
@ -104,7 +106,7 @@ func (r *Runtime) ID() string {
|
||||
return fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtimeName)
|
||||
}
|
||||
|
||||
func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (plugin.Task, error) {
|
||||
func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts) (runtime.Task, error) {
|
||||
var rtSpec RuntimeSpec
|
||||
if err := json.Unmarshal(opts.Spec, &rtSpec); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal oci spec")
|
||||
@ -122,7 +124,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts)
|
||||
return ctr, nil
|
||||
}
|
||||
|
||||
func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, error) {
|
||||
func (r *Runtime) Delete(ctx context.Context, c runtime.Task) (*runtime.Exit, error) {
|
||||
wc, ok := c.(*container)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("container cannot be cast as *windows.container")
|
||||
@ -138,16 +140,16 @@ func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, erro
|
||||
delete(r.containers, wc.ctr.ID())
|
||||
r.Unlock()
|
||||
|
||||
return &plugin.Exit{
|
||||
return &runtime.Exit{
|
||||
Status: ec,
|
||||
Timestamp: wc.ctr.Processes()[0].ExitedAt(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *Runtime) Tasks(ctx context.Context) ([]plugin.Task, error) {
|
||||
func (r *Runtime) Tasks(ctx context.Context) ([]runtime.Task, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
list := make([]plugin.Task, len(r.containers))
|
||||
list := make([]runtime.Task, len(r.containers))
|
||||
for _, c := range r.containers {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@ -159,7 +161,7 @@ func (r *Runtime) Tasks(ctx context.Context) ([]plugin.Task, error) {
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (r *Runtime) Get(ctx context.Context, id string) (plugin.Task, error) {
|
||||
func (r *Runtime) Get(ctx context.Context, id string) (runtime.Task, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
c, ok := r.containers[id]
|
||||
@ -169,10 +171,9 @@ func (r *Runtime) Get(ctx context.Context, id string) (plugin.Task, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (r *Runtime) sendEvent(id string, evType plugin.EventType, pid, exitStatus uint32, exitedAt time.Time) {
|
||||
r.events <- &plugin.Event{
|
||||
func (r *Runtime) sendEvent(id string, evType events.RuntimeEvent_EventType, pid, exitStatus uint32, exitedAt time.Time) {
|
||||
r.events <- &events.RuntimeEvent{
|
||||
Timestamp: time.Now(),
|
||||
Runtime: runtimeName,
|
||||
Type: evType,
|
||||
Pid: pid,
|
||||
ID: id,
|
||||
|
Loading…
Reference in New Issue
Block a user