Merge pull request #485 from crosbymichael/supervisor
Port over supervisor to use grpc shim
This commit is contained in:
commit
8c3158bf5f
13 changed files with 811 additions and 497 deletions
|
@ -123,6 +123,7 @@ func (*CreateContainerResponse) Descriptor() ([]byte, []int) { return fileDescri
|
|||
|
||||
type DeleteContainerRequest struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeleteContainerRequest) Reset() { *m = DeleteContainerRequest{} }
|
||||
|
@ -168,7 +169,7 @@ func (*StartProcessResponse) Descriptor() ([]byte, []int) { return fileDescripto
|
|||
|
||||
type Container struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
BundlePath string `protobuf:"bytes,2,opt,name=bundle_path,json=bundlePath,proto3" json:"bundle_path,omitempty"`
|
||||
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
|
||||
Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.Status" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -178,7 +179,7 @@ func (*Container) Descriptor() ([]byte, []int) { return fileDescriptorExecution,
|
|||
|
||||
type Process struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Pid int64 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||
Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||
Args []string `protobuf:"bytes,3,rep,name=args" json:"args,omitempty"`
|
||||
Env []string `protobuf:"bytes,4,rep,name=env" json:"env,omitempty"`
|
||||
User *User `protobuf:"bytes,5,opt,name=user" json:"user,omitempty"`
|
||||
|
@ -363,9 +364,10 @@ func (this *DeleteContainerRequest) GoString() string {
|
|||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := make([]string, 0, 5)
|
||||
s := make([]string, 0, 6)
|
||||
s = append(s, "&execution.DeleteContainerRequest{")
|
||||
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n")
|
||||
s = append(s, "Pid: "+fmt.Sprintf("%#v", this.Pid)+",\n")
|
||||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
}
|
||||
|
@ -427,7 +429,7 @@ func (this *Container) GoString() string {
|
|||
s := make([]string, 0, 7)
|
||||
s = append(s, "&execution.Container{")
|
||||
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n")
|
||||
s = append(s, "BundlePath: "+fmt.Sprintf("%#v", this.BundlePath)+",\n")
|
||||
s = append(s, "Bundle: "+fmt.Sprintf("%#v", this.Bundle)+",\n")
|
||||
s = append(s, "Status: "+fmt.Sprintf("%#v", this.Status)+",\n")
|
||||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
|
@ -1220,6 +1222,11 @@ func (m *DeleteContainerRequest) MarshalTo(dAtA []byte) (int, error) {
|
|||
i = encodeVarintExecution(dAtA, i, uint64(len(m.ID)))
|
||||
i += copy(dAtA[i:], m.ID)
|
||||
}
|
||||
if m.Pid != 0 {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintExecution(dAtA, i, uint64(m.Pid))
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
|
@ -1397,11 +1404,11 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) {
|
|||
i = encodeVarintExecution(dAtA, i, uint64(len(m.ID)))
|
||||
i += copy(dAtA[i:], m.ID)
|
||||
}
|
||||
if len(m.BundlePath) > 0 {
|
||||
if len(m.Bundle) > 0 {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintExecution(dAtA, i, uint64(len(m.BundlePath)))
|
||||
i += copy(dAtA[i:], m.BundlePath)
|
||||
i = encodeVarintExecution(dAtA, i, uint64(len(m.Bundle)))
|
||||
i += copy(dAtA[i:], m.Bundle)
|
||||
}
|
||||
if m.Status != 0 {
|
||||
dAtA[i] = 0x20
|
||||
|
@ -1940,6 +1947,9 @@ func (m *DeleteContainerRequest) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovExecution(uint64(l))
|
||||
}
|
||||
if m.Pid != 0 {
|
||||
n += 1 + sovExecution(uint64(m.Pid))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -2013,7 +2023,7 @@ func (m *Container) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovExecution(uint64(l))
|
||||
}
|
||||
l = len(m.BundlePath)
|
||||
l = len(m.Bundle)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovExecution(uint64(l))
|
||||
}
|
||||
|
@ -2267,6 +2277,7 @@ func (this *DeleteContainerRequest) String() string {
|
|||
}
|
||||
s := strings.Join([]string{`&DeleteContainerRequest{`,
|
||||
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
|
||||
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
|
@ -2322,7 +2333,7 @@ func (this *Container) String() string {
|
|||
}
|
||||
s := strings.Join([]string{`&Container{`,
|
||||
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
|
||||
`BundlePath:` + fmt.Sprintf("%v", this.BundlePath) + `,`,
|
||||
`Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`,
|
||||
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
|
@ -2948,6 +2959,25 @@ func (m *DeleteContainerRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
m.ID = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
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 ErrIntOverflowExecution
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Pid |= (uint32(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipExecution(dAtA[iNdEx:])
|
||||
|
@ -3491,7 +3521,7 @@ func (m *Container) Unmarshal(dAtA []byte) error {
|
|||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field BundlePath", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Bundle", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
|
@ -3516,7 +3546,7 @@ func (m *Container) Unmarshal(dAtA []byte) error {
|
|||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.BundlePath = string(dAtA[iNdEx:postIndex])
|
||||
m.Bundle = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
|
@ -3630,7 +3660,7 @@ func (m *Process) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Pid |= (int64(b) & 0x7F) << shift
|
||||
m.Pid |= (uint32(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
@ -5087,68 +5117,69 @@ var (
|
|||
func init() { proto.RegisterFile("execution.proto", fileDescriptorExecution) }
|
||||
|
||||
var fileDescriptorExecution = []byte{
|
||||
// 1007 bytes of a gzipped FileDescriptorProto
|
||||
// 1015 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 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, 0xad, 0x8a, 0x76, 0x06, 0x6b, 0xfc, 0xa9, 0xc0,
|
||||
0x8e, 0x78, 0x28, 0x61, 0x48, 0x92, 0x41, 0x1d, 0x1e, 0x44, 0xa8, 0xf3, 0x88, 0xfc, 0xa3, 0xc9,
|
||||
0xcd, 0x5e, 0x31, 0x72, 0xd4, 0x6e, 0xe0, 0x62, 0x04, 0x6a, 0x5b, 0xe8, 0x18, 0xf2, 0xe3, 0x8d,
|
||||
0xd2, 0x16, 0xc2, 0xfe, 0xf7, 0x07, 0xf2, 0x25, 0x94, 0xe7, 0x83, 0x93, 0xf9, 0x9a, 0x61, 0xaa,
|
||||
0x6c, 0xc4, 0xd4, 0xa0, 0x50, 0x88, 0xe2, 0xbe, 0x7b, 0x41, 0x1c, 0x72, 0x9e, 0x26, 0xf3, 0xa9,
|
||||
0x08, 0xeb, 0x61, 0x7d, 0x77, 0xe1, 0xd8, 0x9e, 0x58, 0xc4, 0x12, 0x64, 0xfc, 0xae, 0x40, 0x5e,
|
||||
0x32, 0x59, 0x7a, 0x66, 0x09, 0xd2, 0x63, 0xdb, 0x12, 0x67, 0xa5, 0x31, 0x1f, 0x22, 0x04, 0x19,
|
||||
0xd3, 0x1b, 0x52, 0x3d, 0x2d, 0xde, 0x8e, 0x18, 0x73, 0x14, 0x71, 0xae, 0xf4, 0x8c, 0x30, 0xf1,
|
||||
0x21, 0xfa, 0x00, 0x32, 0x3e, 0x25, 0x9e, 0x48, 0x64, 0xb1, 0xbe, 0xb3, 0x40, 0xa4, 0x4f, 0x89,
|
||||
0x87, 0x05, 0x80, 0x6f, 0x1d, 0xbc, 0xb6, 0x64, 0x62, 0xf9, 0x10, 0x55, 0x60, 0x9b, 0x11, 0xef,
|
||||
0xd2, 0x76, 0xcc, 0x91, 0x9e, 0x17, 0xd7, 0x16, 0xcd, 0x79, 0x0a, 0xc8, 0xb5, 0xcd, 0xce, 0x65,
|
||||
0x98, 0xdb, 0xfb, 0xca, 0x81, 0x8a, 0x81, 0x9b, 0x82, 0xd8, 0x0c, 0x0c, 0x99, 0xbe, 0x74, 0xeb,
|
||||
0xcb, 0x80, 0x54, 0xcc, 0x87, 0xdc, 0x32, 0x94, 0x91, 0xa8, 0x98, 0x0f, 0xd1, 0x53, 0x78, 0x68,
|
||||
0x5a, 0x96, 0xcd, 0x85, 0xd1, 0x1c, 0xb5, 0x6c, 0x2b, 0x88, 0x49, 0xc5, 0x0b, 0x56, 0xe3, 0x10,
|
||||
0x76, 0x5a, 0x64, 0x73, 0xa9, 0xeb, 0x40, 0x79, 0x1e, 0xfe, 0xef, 0x24, 0xc3, 0xb8, 0x04, 0xad,
|
||||
0x3f, 0xb6, 0x92, 0x94, 0xf3, 0x2e, 0x55, 0xb4, 0xee, 0x11, 0x71, 0x69, 0xef, 0x9a, 0x3e, 0xdd,
|
||||
0x5c, 0x66, 0x8e, 0x41, 0xc3, 0x84, 0xfa, 0x97, 0x9b, 0xef, 0xf0, 0xe1, 0xad, 0x16, 0xf9, 0x2f,
|
||||
0x24, 0xe1, 0x23, 0x00, 0x59, 0x41, 0xe7, 0xf2, 0x6a, 0x0b, 0x27, 0xea, 0xe4, 0x66, 0xaf, 0x20,
|
||||
0x7d, 0xb7, 0x1b, 0xb8, 0x20, 0x01, 0x6d, 0xcb, 0xf8, 0x02, 0xd0, 0xec, 0xb1, 0x77, 0x2e, 0xd6,
|
||||
0x9f, 0x15, 0x28, 0xf7, 0xec, 0xa1, 0x63, 0x8e, 0xee, 0x3b, 0x04, 0xa1, 0x44, 0xe2, 0x64, 0x21,
|
||||
0x68, 0x2a, 0x96, 0x33, 0xe3, 0x1a, 0xca, 0xc1, 0xe7, 0x70, 0xef, 0x49, 0xad, 0x41, 0x99, 0xff,
|
||||
0x1a, 0x72, 0x8d, 0xd0, 0x75, 0x77, 0xff, 0x55, 0xf0, 0x29, 0xcd, 0xe0, 0xe5, 0x3d, 0x7c, 0x0a,
|
||||
0xa1, 0x57, 0x12, 0xfe, 0x31, 0xcb, 0x6e, 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a, 0x94, 0x74, 0xfa, 0x12, 0x1e, 0xcc, 0xf6, 0x0e, 0x31, 0xb6,
|
||||
0x09, 0x5d, 0x53, 0x8c, 0x6d, 0x62, 0xf3, 0xf1, 0x0d, 0xc0, 0x54, 0xe5, 0xd0, 0x7e, 0x3c, 0xc0,
|
||||
0x05, 0xa7, 0xef, 0xad, 0x40, 0x48, 0x97, 0x67, 0xa0, 0xce, 0xe9, 0x1d, 0x8a, 0x11, 0x49, 0x50,
|
||||
0xc3, 0xa5, 0xd7, 0x73, 0x06, 0xea, 0x9c, 0x56, 0xc5, 0xbc, 0x25, 0x29, 0xd9, 0x52, 0x6f, 0xdf,
|
||||
0x82, 0x3a, 0xa7, 0x27, 0x31, 0x6f, 0x49, 0xea, 0x54, 0x79, 0xbc, 0x1a, 0x14, 0xc4, 0x7d, 0xf2,
|
||||
0xee, 0x9b, 0xdb, 0xea, 0xd6, 0x1f, 0xb7, 0xd5, 0xad, 0xbf, 0x6f, 0xab, 0xca, 0x8f, 0x93, 0xaa,
|
||||
0xf2, 0x66, 0x52, 0x55, 0x7e, 0x9b, 0x54, 0x95, 0xbf, 0x26, 0x55, 0xe5, 0x22, 0x27, 0x98, 0x7c,
|
||||
0xf2, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x83, 0x5f, 0xe2, 0xb2, 0x5f, 0x0d, 0x00, 0x00,
|
||||
0x14, 0xae, 0xf3, 0xe3, 0x34, 0x27, 0xeb, 0xdd, 0x30, 0x4d, 0x8d, 0x15, 0x50, 0x5a, 0xcc, 0xee,
|
||||
0xb2, 0x42, 0x34, 0x5d, 0x02, 0x42, 0x2b, 0x71, 0xb5, 0x6d, 0x42, 0x88, 0x54, 0x42, 0x98, 0x6c,
|
||||
0xb4, 0x12, 0x37, 0x95, 0x1b, 0x0f, 0x59, 0xa3, 0xd4, 0x0e, 0x9e, 0x71, 0xb7, 0xdc, 0x71, 0xcf,
|
||||
0x0d, 0x2f, 0xc0, 0x43, 0xf0, 0x16, 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xe7, 0x04, 0xb4, 0x05,
|
||||
0xaf, 0x4a, 0x44, 0x4b, 0x73, 0xb2, 0x95, 0xd1, 0xbe, 0x06, 0x6d, 0xc1, 0x4f, 0x12, 0xd1, 0xd2,
|
||||
0xdc, 0xa9, 0x7a, 0x7f, 0x3d, 0x28, 0xd4, 0x7d, 0xf4, 0xf6, 0xab, 0xeb, 0xda, 0xd6, 0xef, 0xd7,
|
||||
0xb5, 0xad, 0xbf, 0xae, 0x6b, 0xca, 0x0f, 0xd3, 0x9a, 0xf2, 0x6a, 0x5a, 0x53, 0x7e, 0x9d, 0xd6,
|
||||
0x94, 0x3f, 0xa7, 0x35, 0xe5, 0x4c, 0x15, 0x4c, 0x3e, 0xfa, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x81,
|
||||
0x43, 0xb0, 0xe4, 0x68, 0x0d, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ message CreateContainerResponse {
|
|||
|
||||
message DeleteContainerRequest {
|
||||
string id = 1 [(gogoproto.customname) = "ID"];
|
||||
uint32 pid = 2;
|
||||
}
|
||||
|
||||
message ListContainersRequest {
|
||||
|
@ -68,13 +69,13 @@ message StartProcessResponse {
|
|||
|
||||
message Container {
|
||||
string id = 1 [(gogoproto.customname) = "ID"];
|
||||
string bundle_path = 2;
|
||||
string bundle = 2;
|
||||
Status status = 4;
|
||||
}
|
||||
|
||||
message Process {
|
||||
string id = 1 [(gogoproto.customname) = "ID"];
|
||||
int64 pid = 2;
|
||||
uint32 pid = 2;
|
||||
repeated string args = 3;
|
||||
repeated string env = 4;
|
||||
User user = 5;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
StateRequest
|
||||
StateResponse
|
||||
Process
|
||||
PauseRequest
|
||||
ResumeRequest
|
||||
*/
|
||||
package shim
|
||||
|
||||
|
@ -62,23 +64,23 @@ type EventType int32
|
|||
const (
|
||||
EventType_EXIT EventType = 0
|
||||
EventType_OOM EventType = 1
|
||||
EventType_CREATED EventType = 2
|
||||
EventType_STARTED EventType = 3
|
||||
EventType_CREATE EventType = 2
|
||||
EventType_START EventType = 3
|
||||
EventType_EXEC_ADDED EventType = 4
|
||||
)
|
||||
|
||||
var EventType_name = map[int32]string{
|
||||
0: "EXIT",
|
||||
1: "OOM",
|
||||
2: "CREATED",
|
||||
3: "STARTED",
|
||||
2: "CREATE",
|
||||
3: "START",
|
||||
4: "EXEC_ADDED",
|
||||
}
|
||||
var EventType_value = map[string]int32{
|
||||
"EXIT": 0,
|
||||
"OOM": 1,
|
||||
"CREATED": 2,
|
||||
"STARTED": 3,
|
||||
"CREATE": 2,
|
||||
"START": 3,
|
||||
"EXEC_ADDED": 4,
|
||||
}
|
||||
|
||||
|
@ -87,20 +89,27 @@ func (x EventType) String() string {
|
|||
}
|
||||
func (EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorShim, []int{0} }
|
||||
|
||||
// TODO: share core runtime types between shim and execution rpcs
|
||||
type State int32
|
||||
|
||||
const (
|
||||
State_STOPPED State = 0
|
||||
State_RUNNING State = 1
|
||||
State_PAUSED State = 2
|
||||
State_CREATED State = 3
|
||||
)
|
||||
|
||||
var State_name = map[int32]string{
|
||||
0: "STOPPED",
|
||||
1: "RUNNING",
|
||||
2: "PAUSED",
|
||||
3: "CREATED",
|
||||
}
|
||||
var State_value = map[string]int32{
|
||||
"STOPPED": 0,
|
||||
"RUNNING": 1,
|
||||
"PAUSED": 2,
|
||||
"CREATED": 3,
|
||||
}
|
||||
|
||||
func (x State) String() string {
|
||||
|
@ -239,7 +248,8 @@ func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, [
|
|||
|
||||
type StateResponse struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Processes []*Process `protobuf:"bytes,2,rep,name=processes" json:"processes,omitempty"`
|
||||
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
|
||||
Processes []*Process `protobuf:"bytes,3,rep,name=processes" json:"processes,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StateResponse) Reset() { *m = StateResponse{} }
|
||||
|
@ -255,6 +265,20 @@ func (m *Process) Reset() { *m = Process{} }
|
|||
func (*Process) ProtoMessage() {}
|
||||
func (*Process) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} }
|
||||
|
||||
type PauseRequest struct {
|
||||
}
|
||||
|
||||
func (m *PauseRequest) Reset() { *m = PauseRequest{} }
|
||||
func (*PauseRequest) ProtoMessage() {}
|
||||
func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} }
|
||||
|
||||
type ResumeRequest struct {
|
||||
}
|
||||
|
||||
func (m *ResumeRequest) Reset() { *m = ResumeRequest{} }
|
||||
func (*ResumeRequest) ProtoMessage() {}
|
||||
func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*CreateRequest)(nil), "containerd.shim.v1.CreateRequest")
|
||||
proto.RegisterType((*CreateResponse)(nil), "containerd.shim.v1.CreateResponse")
|
||||
|
@ -271,6 +295,8 @@ func init() {
|
|||
proto.RegisterType((*StateRequest)(nil), "containerd.shim.v1.StateRequest")
|
||||
proto.RegisterType((*StateResponse)(nil), "containerd.shim.v1.StateResponse")
|
||||
proto.RegisterType((*Process)(nil), "containerd.shim.v1.Process")
|
||||
proto.RegisterType((*PauseRequest)(nil), "containerd.shim.v1.PauseRequest")
|
||||
proto.RegisterType((*ResumeRequest)(nil), "containerd.shim.v1.ResumeRequest")
|
||||
proto.RegisterEnum("containerd.shim.v1.EventType", EventType_name, EventType_value)
|
||||
proto.RegisterEnum("containerd.shim.v1.State", State_name, State_value)
|
||||
}
|
||||
|
@ -437,9 +463,10 @@ func (this *StateResponse) GoString() string {
|
|||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := make([]string, 0, 6)
|
||||
s := make([]string, 0, 7)
|
||||
s = append(s, "&shim.StateResponse{")
|
||||
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n")
|
||||
s = append(s, "Bundle: "+fmt.Sprintf("%#v", this.Bundle)+",\n")
|
||||
if this.Processes != nil {
|
||||
s = append(s, "Processes: "+fmt.Sprintf("%#v", this.Processes)+",\n")
|
||||
}
|
||||
|
@ -457,6 +484,24 @@ func (this *Process) GoString() string {
|
|||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
}
|
||||
func (this *PauseRequest) GoString() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := make([]string, 0, 4)
|
||||
s = append(s, "&shim.PauseRequest{")
|
||||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
}
|
||||
func (this *ResumeRequest) GoString() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := make([]string, 0, 4)
|
||||
s = append(s, "&shim.ResumeRequest{")
|
||||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
}
|
||||
func valueToGoStringShim(v interface{}, typ string) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
|
@ -502,6 +547,8 @@ type ShimClient interface {
|
|||
Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
|
||||
Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error)
|
||||
State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error)
|
||||
Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
|
||||
Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
|
||||
}
|
||||
|
||||
type shimClient struct {
|
||||
|
@ -598,6 +645,24 @@ func (c *shimClient) State(ctx context.Context, in *StateRequest, opts ...grpc.C
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *shimClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
|
||||
out := new(google_protobuf.Empty)
|
||||
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Pause", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *shimClient) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
|
||||
out := new(google_protobuf.Empty)
|
||||
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Resume", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Shim service
|
||||
|
||||
type ShimServer interface {
|
||||
|
@ -608,6 +673,8 @@ type ShimServer interface {
|
|||
Pty(context.Context, *PtyRequest) (*google_protobuf.Empty, error)
|
||||
Events(*EventsRequest, Shim_EventsServer) error
|
||||
State(context.Context, *StateRequest) (*StateResponse, error)
|
||||
Pause(context.Context, *PauseRequest) (*google_protobuf.Empty, error)
|
||||
Resume(context.Context, *ResumeRequest) (*google_protobuf.Empty, error)
|
||||
}
|
||||
|
||||
func RegisterShimServer(s *grpc.Server, srv ShimServer) {
|
||||
|
@ -743,6 +810,42 @@ func _Shim_State_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Shim_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PauseRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ShimServer).Pause(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/containerd.shim.v1.Shim/Pause",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ShimServer).Pause(ctx, req.(*PauseRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Shim_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ResumeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ShimServer).Resume(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/containerd.shim.v1.Shim/Resume",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ShimServer).Resume(ctx, req.(*ResumeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Shim_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "containerd.shim.v1.Shim",
|
||||
HandlerType: (*ShimServer)(nil),
|
||||
|
@ -771,6 +874,14 @@ var _Shim_serviceDesc = grpc.ServiceDesc{
|
|||
MethodName: "State",
|
||||
Handler: _Shim_State_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Pause",
|
||||
Handler: _Shim_Pause_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Resume",
|
||||
Handler: _Shim_Resume_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
@ -1315,9 +1426,15 @@ func (m *StateResponse) MarshalTo(dAtA []byte) (int, error) {
|
|||
i = encodeVarintShim(dAtA, i, uint64(len(m.ID)))
|
||||
i += copy(dAtA[i:], m.ID)
|
||||
}
|
||||
if len(m.Bundle) > 0 {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(len(m.Bundle)))
|
||||
i += copy(dAtA[i:], m.Bundle)
|
||||
}
|
||||
if len(m.Processes) > 0 {
|
||||
for _, msg := range m.Processes {
|
||||
dAtA[i] = 0x12
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
|
@ -1358,6 +1475,42 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) {
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *PauseRequest) 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 *PauseRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *ResumeRequest) 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 *ResumeRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
|
@ -1615,6 +1768,10 @@ func (m *StateResponse) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovShim(uint64(l))
|
||||
}
|
||||
l = len(m.Bundle)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovShim(uint64(l))
|
||||
}
|
||||
if len(m.Processes) > 0 {
|
||||
for _, e := range m.Processes {
|
||||
l = e.Size()
|
||||
|
@ -1636,6 +1793,18 @@ func (m *Process) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *PauseRequest) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ResumeRequest) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func sovShim(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
|
@ -1810,6 +1979,7 @@ func (this *StateResponse) String() string {
|
|||
}
|
||||
s := strings.Join([]string{`&StateResponse{`,
|
||||
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
|
||||
`Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`,
|
||||
`Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "Process", 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
|
@ -1826,6 +1996,24 @@ func (this *Process) String() string {
|
|||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *PauseRequest) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&PauseRequest{`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *ResumeRequest) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&ResumeRequest{`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func valueToStringShim(v interface{}) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
|
@ -3508,6 +3696,35 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error {
|
|||
m.ID = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Bundle", 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.Bundle = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Processes", wireType)
|
||||
}
|
||||
|
@ -3647,6 +3864,106 @@ func (m *Process) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PauseRequest) 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: PauseRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PauseRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
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 *ResumeRequest) 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: ResumeRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ResumeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
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 skipShim(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
@ -3755,66 +4072,69 @@ var (
|
|||
func init() { proto.RegisterFile("shim.proto", fileDescriptorShim) }
|
||||
|
||||
var fileDescriptorShim = []byte{
|
||||
// 962 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x55, 0xcd, 0x6e, 0xe3, 0x36,
|
||||
0x10, 0x8e, 0x2c, 0xc5, 0x3f, 0xe3, 0xc8, 0x71, 0x89, 0x45, 0xa0, 0x78, 0x5b, 0xc7, 0x51, 0x0f,
|
||||
0x4d, 0x83, 0xc2, 0x69, 0xd2, 0x5e, 0x7a, 0xe8, 0x21, 0x1b, 0x0b, 0xbb, 0x01, 0xd2, 0xc4, 0x60,
|
||||
0xb2, 0xc0, 0xde, 0x0c, 0x39, 0x62, 0x6c, 0x02, 0xb2, 0xa4, 0x92, 0x94, 0x13, 0xdf, 0x7a, 0xe9,
|
||||
0xb1, 0x4f, 0xd2, 0x17, 0xd9, 0x63, 0x4f, 0x45, 0x4f, 0x45, 0xe3, 0x27, 0xe8, 0x23, 0x2c, 0x48,
|
||||
0x4a, 0xf6, 0x66, 0x23, 0xed, 0x6d, 0xe6, 0xd3, 0xa7, 0xe1, 0x7c, 0xc3, 0x99, 0x21, 0x00, 0x9f,
|
||||
0xd2, 0x59, 0x3f, 0x61, 0xb1, 0x88, 0x11, 0xba, 0x8d, 0x23, 0xe1, 0xd3, 0x88, 0xb0, 0xa0, 0xaf,
|
||||
0xe0, 0xf9, 0x71, 0xe7, 0xe5, 0x24, 0x8e, 0x27, 0x21, 0x39, 0x52, 0x8c, 0x71, 0x7a, 0x77, 0x44,
|
||||
0x66, 0x89, 0x58, 0xe8, 0x1f, 0x3a, 0x2f, 0x26, 0xf1, 0x24, 0x56, 0xe6, 0x91, 0xb4, 0x34, 0xea,
|
||||
0xfe, 0x6d, 0x80, 0x7d, 0xc6, 0x88, 0x2f, 0x08, 0x26, 0xbf, 0xa6, 0x84, 0x0b, 0xb4, 0x03, 0x15,
|
||||
0x1a, 0x38, 0x46, 0xcf, 0x38, 0x68, 0xbc, 0xaa, 0x2e, 0xff, 0xdd, 0xab, 0x9c, 0x0f, 0x70, 0x85,
|
||||
0x06, 0x68, 0x07, 0xaa, 0xe3, 0x34, 0x0a, 0x42, 0xe2, 0x54, 0xe4, 0x37, 0x9c, 0x79, 0xc8, 0x81,
|
||||
0x1a, 0x4b, 0x23, 0x41, 0x67, 0xc4, 0x31, 0xd5, 0x87, 0xdc, 0x45, 0xbb, 0x50, 0x8f, 0xe2, 0x51,
|
||||
0x42, 0xe7, 0xb1, 0x70, 0xac, 0x9e, 0x71, 0x50, 0xc7, 0xb5, 0x28, 0x1e, 0x4a, 0x17, 0x75, 0xa0,
|
||||
0x2e, 0x08, 0x9b, 0xd1, 0xc8, 0x0f, 0x9d, 0x4d, 0xf5, 0x69, 0xe5, 0xa3, 0x17, 0xb0, 0xc9, 0x45,
|
||||
0x40, 0x23, 0xa7, 0xaa, 0xc2, 0x69, 0x47, 0x1e, 0xcf, 0x45, 0x10, 0xa7, 0xc2, 0xa9, 0xe9, 0xe3,
|
||||
0xb5, 0x97, 0xe1, 0x84, 0x31, 0xa7, 0xbe, 0xc2, 0x09, 0x63, 0xae, 0x0b, 0xad, 0x5c, 0x17, 0x4f,
|
||||
0xe2, 0x88, 0x13, 0xd4, 0x06, 0x33, 0xc9, 0x94, 0xd9, 0x58, 0x9a, 0x6e, 0x0b, 0xb6, 0xae, 0x85,
|
||||
0xcf, 0x44, 0x26, 0xdd, 0xdd, 0x07, 0x7b, 0x40, 0x42, 0xb2, 0xae, 0xc5, 0xf3, 0x5f, 0x8e, 0xa1,
|
||||
0x95, 0x53, 0xb2, 0xb0, 0x7b, 0xd0, 0x24, 0x0f, 0x54, 0x8c, 0xb8, 0xf0, 0x45, 0xca, 0x33, 0x2e,
|
||||
0x48, 0xe8, 0x5a, 0x21, 0xee, 0x9f, 0x26, 0x34, 0xbd, 0x07, 0x72, 0x9b, 0x07, 0xfd, 0x58, 0xbb,
|
||||
0x51, 0xa6, 0xbd, 0x52, 0xac, 0xdd, 0x2c, 0xd1, 0x6e, 0x7d, 0xac, 0x1d, 0x7d, 0x0d, 0x36, 0x27,
|
||||
0x21, 0x8d, 0xd2, 0x87, 0x51, 0xe8, 0x8f, 0x89, 0x2e, 0x71, 0x03, 0x6f, 0x65, 0xe0, 0x85, 0xc4,
|
||||
0xd0, 0x77, 0x60, 0xa5, 0x9c, 0x30, 0x55, 0xe5, 0xe6, 0x89, 0xd3, 0x7f, 0xde, 0x4f, 0xfd, 0xb7,
|
||||
0x9c, 0x30, 0xac, 0x58, 0x08, 0x81, 0xe5, 0xb3, 0x09, 0x77, 0x6a, 0x3d, 0xf3, 0xa0, 0x81, 0x95,
|
||||
0x2d, 0xab, 0x43, 0xa2, 0xb9, 0x53, 0x57, 0x90, 0x34, 0x25, 0x72, 0x7b, 0x1f, 0x38, 0x0d, 0x75,
|
||||
0x9c, 0x34, 0x91, 0x0b, 0x5b, 0xb7, 0x7e, 0xe2, 0x8f, 0x69, 0x48, 0x05, 0x25, 0xdc, 0x01, 0x45,
|
||||
0x7e, 0x82, 0xa1, 0x1f, 0xa1, 0xc6, 0x42, 0x3a, 0xa3, 0x82, 0x3b, 0xcd, 0x9e, 0x79, 0xd0, 0x3c,
|
||||
0xe9, 0x14, 0x25, 0x83, 0x15, 0x05, 0xe7, 0x54, 0x74, 0x08, 0x5f, 0x44, 0xf1, 0x28, 0x22, 0xf7,
|
||||
0xa3, 0x84, 0xd1, 0x39, 0x0d, 0xc9, 0x84, 0x70, 0x67, 0x4b, 0xd5, 0x73, 0x3b, 0x8a, 0x2f, 0xc9,
|
||||
0xfd, 0x70, 0x05, 0xa3, 0x6f, 0xa1, 0xed, 0x27, 0x89, 0xcf, 0x66, 0x31, 0x1b, 0x25, 0x2c, 0xbe,
|
||||
0xa3, 0x21, 0x71, 0x6c, 0x95, 0xe4, 0x76, 0x8e, 0x0f, 0x35, 0xec, 0x5e, 0x83, 0x25, 0x65, 0x4b,
|
||||
0x29, 0xe9, 0xfa, 0xea, 0x53, 0x1a, 0x48, 0x64, 0x42, 0x03, 0x75, 0x33, 0x36, 0x96, 0x26, 0xfa,
|
||||
0x06, 0xb6, 0xfd, 0x20, 0xa0, 0x82, 0xc6, 0x91, 0x1f, 0x8e, 0x26, 0x34, 0xe0, 0x8e, 0xd9, 0x33,
|
||||
0x0f, 0x6c, 0xdc, 0x5a, 0xc3, 0xaf, 0x69, 0xc0, 0xdd, 0x01, 0x54, 0x75, 0xfa, 0xb2, 0x8e, 0x62,
|
||||
0x91, 0x10, 0x3d, 0x5f, 0x58, 0xd9, 0x12, 0x9b, 0xfa, 0x4c, 0x47, 0xb6, 0xb0, 0xb2, 0x25, 0xc6,
|
||||
0xe3, 0x3b, 0x7d, 0xe1, 0x16, 0x56, 0xb6, 0xdb, 0x83, 0x2d, 0xdd, 0x47, 0xa5, 0x0d, 0x7d, 0x01,
|
||||
0x30, 0x14, 0x8b, 0xd2, 0xee, 0x95, 0xed, 0x75, 0x4f, 0x03, 0x31, 0xcd, 0x44, 0x68, 0x47, 0xb6,
|
||||
0xd1, 0x94, 0xd0, 0xc9, 0x54, 0x9f, 0x66, 0xe3, 0xcc, 0x73, 0xb7, 0xc1, 0xf6, 0xe6, 0x24, 0x12,
|
||||
0x3c, 0x9f, 0x8f, 0xdf, 0x0d, 0xd8, 0x54, 0x48, 0xe9, 0x92, 0x38, 0xce, 0xe4, 0xc9, 0xf8, 0xad,
|
||||
0x93, 0xaf, 0x8a, 0xee, 0x51, 0x05, 0xb8, 0x59, 0x24, 0x24, 0x53, 0x9f, 0x65, 0x69, 0xae, 0xb3,
|
||||
0xfc, 0x64, 0xa2, 0xac, 0x67, 0x13, 0xa5, 0xe7, 0x76, 0x35, 0xa6, 0xee, 0x18, 0xec, 0xcc, 0xcf,
|
||||
0x2a, 0x53, 0x96, 0xde, 0x4f, 0xd0, 0x48, 0x58, 0x7c, 0x4b, 0x38, 0x27, 0xdc, 0xa9, 0xa8, 0x5e,
|
||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57, 0xd8, 0x7c, 0xeb,
|
||||
0x3d, 0xdc, 0xe9, 0x95, 0x13, 0xb2, 0x50, 0x3f, 0x83, 0x39, 0x14, 0x0b, 0xd4, 0x2d, 0x6c, 0x91,
|
||||
0xd5, 0x9c, 0x95, 0x4a, 0x7b, 0x03, 0x55, 0x3d, 0x3f, 0xc5, 0xd2, 0x9e, 0xcc, 0x56, 0x67, 0xb7,
|
||||
0x94, 0xf2, 0xbd, 0x81, 0x2e, 0xf2, 0x4b, 0xee, 0x95, 0x77, 0x56, 0x16, 0x67, 0xff, 0x33, 0x0c,
|
||||
0x2d, 0xeb, 0xd5, 0x97, 0xef, 0x1f, 0xbb, 0x1b, 0xff, 0x3c, 0x76, 0x37, 0xfe, 0x7f, 0xec, 0x1a,
|
||||
0xbf, 0x2d, 0xbb, 0xc6, 0xfb, 0x65, 0xd7, 0xf8, 0x6b, 0xd9, 0x35, 0xfe, 0x5b, 0x76, 0x8d, 0x71,
|
||||
0x55, 0xa9, 0xf8, 0xe1, 0x43, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0d, 0xe7, 0x6c, 0xde, 0x6d, 0x08,
|
||||
0x00, 0x00,
|
||||
// 1018 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x6e, 0xe3, 0xb6,
|
||||
0x13, 0x8e, 0x2c, 0xf9, 0xdf, 0x38, 0x72, 0xfc, 0x23, 0x16, 0x81, 0xe2, 0xfd, 0xd5, 0x71, 0xd4,
|
||||
0x43, 0xd3, 0xa0, 0x70, 0x9a, 0xb4, 0x97, 0x16, 0xe8, 0x21, 0x1b, 0x0b, 0xdb, 0x00, 0x69, 0x62,
|
||||
0xd0, 0x0e, 0xb0, 0x37, 0x43, 0x89, 0x18, 0x9b, 0x80, 0x2c, 0xa9, 0x24, 0x95, 0x3f, 0x3d, 0xf5,
|
||||
0xd2, 0x47, 0xe8, 0x53, 0xf4, 0x45, 0xf6, 0xd8, 0x53, 0xd1, 0x53, 0xd1, 0xe4, 0x09, 0xfa, 0x08,
|
||||
0x05, 0x49, 0xc9, 0x4e, 0x36, 0xd2, 0x02, 0xbd, 0xcd, 0x7c, 0xfa, 0x34, 0x9c, 0x6f, 0x38, 0x33,
|
||||
0x04, 0xe0, 0x73, 0xba, 0x18, 0x24, 0x2c, 0x16, 0x31, 0x42, 0x57, 0x71, 0x24, 0x7c, 0x1a, 0x11,
|
||||
0x16, 0x0c, 0x14, 0x7c, 0x73, 0xd0, 0x7d, 0x3d, 0x8b, 0xe3, 0x59, 0x48, 0xf6, 0x15, 0xe3, 0x32,
|
||||
0xbd, 0xde, 0x27, 0x8b, 0x44, 0xdc, 0xeb, 0x1f, 0xba, 0xaf, 0x66, 0xf1, 0x2c, 0x56, 0xe6, 0xbe,
|
||||
0xb4, 0x34, 0xea, 0xfe, 0x61, 0x80, 0x7d, 0xcc, 0x88, 0x2f, 0x08, 0x26, 0x3f, 0xa6, 0x84, 0x0b,
|
||||
0xb4, 0x09, 0x15, 0x1a, 0x38, 0x46, 0xdf, 0xd8, 0x6d, 0xbe, 0xa9, 0x3d, 0xfe, 0xb5, 0x5d, 0x39,
|
||||
0x19, 0xe2, 0x0a, 0x0d, 0xd0, 0x26, 0xd4, 0x2e, 0xd3, 0x28, 0x08, 0x89, 0x53, 0x91, 0xdf, 0x70,
|
||||
0xe6, 0x21, 0x07, 0xea, 0x2c, 0x8d, 0x04, 0x5d, 0x10, 0xc7, 0x54, 0x1f, 0x72, 0x17, 0x6d, 0x41,
|
||||
0x23, 0x8a, 0xa7, 0x09, 0xbd, 0x89, 0x85, 0x63, 0xf5, 0x8d, 0xdd, 0x06, 0xae, 0x47, 0xf1, 0x48,
|
||||
0xba, 0xa8, 0x0b, 0x0d, 0x41, 0xd8, 0x82, 0x46, 0x7e, 0xe8, 0x54, 0xd5, 0xa7, 0xa5, 0x8f, 0x5e,
|
||||
0x41, 0x95, 0x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xbf, 0x5f, 0xde, 0x90, 0x59, 0x9c,
|
||||
0x9d, 0x8f, 0x30, 0x56, 0xb7, 0xa6, 0x7a, 0xb6, 0x38, 0xda, 0xd3, 0x76, 0x2e, 0x95, 0x76, 0x0c,
|
||||
0x35, 0xdd, 0xe6, 0xc5, 0xd2, 0x9e, 0x8d, 0x40, 0x59, 0x90, 0x37, 0xff, 0x7f, 0xff, 0xd0, 0x5b,
|
||||
0xfb, 0xf3, 0xa1, 0xb7, 0xf6, 0xcf, 0x43, 0xcf, 0xf8, 0xf9, 0xb1, 0x67, 0xbc, 0x7f, 0xec, 0x19,
|
||||
0xbf, 0x3f, 0xf6, 0x8c, 0xbf, 0x1f, 0x7b, 0xc6, 0x65, 0x4d, 0xb1, 0xbf, 0xfa, 0x37, 0x00, 0x00,
|
||||
0xff, 0xff, 0x62, 0xce, 0xef, 0x76, 0x44, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ service Shim {
|
|||
rpc Pty(PtyRequest) returns (google.protobuf.Empty);
|
||||
rpc Events(EventsRequest) returns (stream Event);
|
||||
rpc State(StateRequest) returns (StateResponse);
|
||||
rpc Pause(PauseRequest) returns (google.protobuf.Empty);
|
||||
rpc Resume(ResumeRequest) returns (google.protobuf.Empty);
|
||||
}
|
||||
|
||||
message CreateRequest {
|
||||
|
@ -85,8 +87,8 @@ message EventsRequest {
|
|||
enum EventType {
|
||||
EXIT = 0;
|
||||
OOM = 1;
|
||||
CREATED = 2;
|
||||
STARTED = 3;
|
||||
CREATE = 2;
|
||||
START = 3;
|
||||
EXEC_ADDED = 4;
|
||||
}
|
||||
|
||||
|
@ -102,15 +104,25 @@ message StateRequest {
|
|||
|
||||
message StateResponse {
|
||||
string id = 1 [(gogoproto.customname) = "ID"];
|
||||
repeated Process processes = 2;
|
||||
string bundle = 2;
|
||||
repeated Process processes = 3;
|
||||
}
|
||||
|
||||
// TODO: share core runtime types between shim and execution rpcs
|
||||
enum State {
|
||||
STOPPED = 0;
|
||||
RUNNING = 1;
|
||||
PAUSED = 2;
|
||||
CREATED = 3;
|
||||
}
|
||||
|
||||
message Process {
|
||||
uint32 pid = 1;
|
||||
State state = 2;
|
||||
}
|
||||
|
||||
message PauseRequest {
|
||||
}
|
||||
|
||||
message ResumeRequest {
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ func main() {
|
|||
}
|
||||
var (
|
||||
server = grpc.NewServer()
|
||||
sv = shim.NewService()
|
||||
sv = shim.New()
|
||||
)
|
||||
logrus.Debug("registering grpc server")
|
||||
apishim.RegisterShimServer(server, sv)
|
||||
|
|
|
@ -22,9 +22,8 @@ import (
|
|||
"github.com/docker/containerd"
|
||||
api "github.com/docker/containerd/api/execution"
|
||||
"github.com/docker/containerd/events"
|
||||
"github.com/docker/containerd/execution"
|
||||
"github.com/docker/containerd/execution/executors/shim"
|
||||
"github.com/docker/containerd/log"
|
||||
"github.com/docker/containerd/supervisor"
|
||||
"github.com/docker/containerd/utils"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/urfave/cli"
|
||||
|
@ -58,11 +57,6 @@ func main() {
|
|||
Usage: "containerd state directory",
|
||||
Value: "/run/containerd",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "runtime",
|
||||
Usage: "runtime for execution",
|
||||
Value: "shim",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "socket, s",
|
||||
Usage: "socket path for containerd's GRPC server",
|
||||
|
@ -139,29 +133,14 @@ func main() {
|
|||
}
|
||||
defer nec.Close()
|
||||
|
||||
var (
|
||||
executor execution.Executor
|
||||
runtime = context.GlobalString("runtime")
|
||||
)
|
||||
log.G(ctx).WithField("runtime", runtime).Info("run with runtime executor")
|
||||
execCtx := log.WithModule(ctx, "execution")
|
||||
execCtx = events.WithPoster(execCtx, events.GetNATSPoster(nec))
|
||||
switch runtime {
|
||||
case "shim":
|
||||
root := filepath.Join(context.GlobalString("root"), "shim")
|
||||
err = os.MkdirAll(root, 0700)
|
||||
err = os.Mkdir(root, 0700)
|
||||
if err != nil && !os.IsExist(err) {
|
||||
return err
|
||||
}
|
||||
executor, err = shim.New(log.WithModule(execCtx, "shim"), root, "containerd-shim", "runc", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("oci: runtime %q not implemented", runtime)
|
||||
}
|
||||
|
||||
execService, err := execution.New(execCtx, executor)
|
||||
execService, err := supervisor.New(execCtx, context.GlobalString("root"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ var listCommand = cli.Command{
|
|||
c.ID,
|
||||
c.Status,
|
||||
len(listProcResponse.Processes),
|
||||
c.BundlePath,
|
||||
c.Bundle,
|
||||
)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -292,5 +292,4 @@ func getShimService() (shim.ShimClient, error) {
|
|||
return nil, err
|
||||
}
|
||||
return shim.NewShimClient(conn), nil
|
||||
|
||||
}
|
||||
|
|
|
@ -1,309 +0,0 @@
|
|||
package execution
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
api "github.com/docker/containerd/api/execution"
|
||||
"github.com/docker/containerd/events"
|
||||
google_protobuf "github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var (
|
||||
emptyResponse = &google_protobuf.Empty{}
|
||||
)
|
||||
|
||||
func New(ctx context.Context, executor Executor) (*Service, error) {
|
||||
svc := &Service{
|
||||
executor: executor,
|
||||
}
|
||||
|
||||
// List existing container, some of them may have died away if
|
||||
// we've been restarted
|
||||
containers, err := executor.List(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, c := range containers {
|
||||
status := c.Status()
|
||||
// generate exit event for all processes, (generate event for init last)
|
||||
processes := c.Processes()
|
||||
processes = append(processes[1:], processes[0])
|
||||
for _, p := range c.processes {
|
||||
if status == Stopped || status == Deleted {
|
||||
if p.Status() != Stopped {
|
||||
p.Signal(os.Kill)
|
||||
}
|
||||
sc, err := p.Wait()
|
||||
if err != nil {
|
||||
sc = UnknownStatusCode
|
||||
}
|
||||
topic := GetContainerProcessEventTopic(c.ID(), p.ID())
|
||||
svc.publishEvent(ctx, topic, &ContainerExitEvent{
|
||||
ContainerEvent: ContainerEvent{
|
||||
Timestamp: time.Now(),
|
||||
ID: c.ID(),
|
||||
Action: "exit",
|
||||
},
|
||||
PID: p.ID(),
|
||||
StatusCode: sc,
|
||||
})
|
||||
} else {
|
||||
svc.monitorProcess(ctx, c, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return svc, nil
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
executor Executor
|
||||
}
|
||||
|
||||
func (s *Service) Create(ctx context.Context, r *api.CreateContainerRequest) (*api.CreateContainerResponse, error) {
|
||||
var err error
|
||||
|
||||
container, err := s.executor.Create(ctx, r.ID, CreateOpts{
|
||||
Bundle: r.BundlePath,
|
||||
Console: r.Console,
|
||||
Stdin: r.Stdin,
|
||||
Stdout: r.Stdout,
|
||||
Stderr: r.Stderr,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
procs := container.Processes()
|
||||
initProcess := procs[0]
|
||||
|
||||
s.monitorProcess(ctx, container, initProcess)
|
||||
|
||||
return &api.CreateContainerResponse{
|
||||
Container: toGRPCContainer(container),
|
||||
InitProcess: toGRPCProcess(initProcess),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Service) Delete(ctx context.Context, r *api.DeleteContainerRequest) (*google_protobuf.Empty, error) {
|
||||
container, err := s.executor.Load(ctx, r.ID)
|
||||
if err != nil {
|
||||
return emptyResponse, err
|
||||
}
|
||||
|
||||
if err = s.executor.Delete(ctx, container); err != nil {
|
||||
return emptyResponse, err
|
||||
}
|
||||
return emptyResponse, nil
|
||||
}
|
||||
|
||||
func (s *Service) List(ctx context.Context, r *api.ListContainersRequest) (*api.ListContainersResponse, error) {
|
||||
containers, err := s.executor.List(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := &api.ListContainersResponse{}
|
||||
for _, c := range containers {
|
||||
resp.Containers = append(resp.Containers, toGRPCContainer(c))
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
func (s *Service) Get(ctx context.Context, r *api.GetContainerRequest) (*api.GetContainerResponse, error) {
|
||||
container, err := s.executor.Load(ctx, r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &api.GetContainerResponse{
|
||||
Container: toGRPCContainer(container),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Service) Update(ctx context.Context, r *api.UpdateContainerRequest) (*google_protobuf.Empty, error) {
|
||||
return emptyResponse, nil
|
||||
}
|
||||
|
||||
func (s *Service) Pause(ctx context.Context, r *api.PauseContainerRequest) (*google_protobuf.Empty, error) {
|
||||
container, err := s.executor.Load(ctx, r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return emptyResponse, s.executor.Pause(ctx, container)
|
||||
}
|
||||
|
||||
func (s *Service) Resume(ctx context.Context, r *api.ResumeContainerRequest) (*google_protobuf.Empty, error) {
|
||||
container, err := s.executor.Load(ctx, r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return emptyResponse, s.executor.Resume(ctx, container)
|
||||
}
|
||||
|
||||
func (s *Service) Start(ctx context.Context, r *api.StartContainerRequest) (*google_protobuf.Empty, error) {
|
||||
container, err := s.executor.Load(ctx, r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return emptyResponse, s.executor.Start(ctx, container)
|
||||
}
|
||||
|
||||
func (s *Service) StartProcess(ctx context.Context, r *api.StartProcessRequest) (*api.StartProcessResponse, error) {
|
||||
container, err := s.executor.Load(ctx, r.ContainerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spec := specs.Process{
|
||||
Terminal: r.Process.Terminal,
|
||||
ConsoleSize: specs.Box{
|
||||
Height: 80,
|
||||
Width: 80,
|
||||
},
|
||||
Args: r.Process.Args,
|
||||
Env: r.Process.Env,
|
||||
Cwd: r.Process.Cwd,
|
||||
NoNewPrivileges: true,
|
||||
}
|
||||
|
||||
process, err := s.executor.StartProcess(ctx, container, StartProcessOpts{
|
||||
ID: r.Process.ID,
|
||||
Spec: spec,
|
||||
Console: r.Console,
|
||||
Stdin: r.Stdin,
|
||||
Stdout: r.Stdout,
|
||||
Stderr: r.Stderr,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.monitorProcess(ctx, container, process)
|
||||
|
||||
return &api.StartProcessResponse{
|
||||
Process: toGRPCProcess(process),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// containerd managed execs + system pids forked in container
|
||||
func (s *Service) GetProcess(ctx context.Context, r *api.GetProcessRequest) (*api.GetProcessResponse, error) {
|
||||
container, err := s.executor.Load(ctx, r.ContainerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
process := container.GetProcess(r.ProcessID)
|
||||
if process == nil {
|
||||
return nil, ErrProcessNotFound
|
||||
}
|
||||
return &api.GetProcessResponse{
|
||||
Process: toGRPCProcess(process),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Service) SignalProcess(ctx context.Context, r *api.SignalProcessRequest) (*google_protobuf.Empty, error) {
|
||||
container, err := s.executor.Load(ctx, r.ContainerID)
|
||||
if err != nil {
|
||||
return emptyResponse, err
|
||||
}
|
||||
process := container.GetProcess(r.ProcessID)
|
||||
if process == nil {
|
||||
return nil, fmt.Errorf("Make me a constant! Process not found!")
|
||||
}
|
||||
return emptyResponse, process.Signal(syscall.Signal(r.Signal))
|
||||
}
|
||||
|
||||
func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest) (*google_protobuf.Empty, error) {
|
||||
container, err := s.executor.Load(ctx, r.ContainerID)
|
||||
if err != nil {
|
||||
return emptyResponse, err
|
||||
}
|
||||
if err := s.executor.DeleteProcess(ctx, container, r.ProcessID); err != nil {
|
||||
return emptyResponse, err
|
||||
}
|
||||
return emptyResponse, nil
|
||||
}
|
||||
|
||||
func (s *Service) ListProcesses(ctx context.Context, r *api.ListProcessesRequest) (*api.ListProcessesResponse, error) {
|
||||
container, err := s.executor.Load(ctx, r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
processes := container.Processes()
|
||||
return &api.ListProcessesResponse{
|
||||
Processes: toGRPCProcesses(processes),
|
||||
}, nil
|
||||
}
|
||||
|
||||
var (
|
||||
_ = (api.ExecutionServiceServer)(&Service{})
|
||||
)
|
||||
|
||||
func (s *Service) publishEvent(ctx context.Context, topic string, v interface{}) {
|
||||
ctx = events.WithTopic(ctx, topic)
|
||||
events.GetPoster(ctx).Post(ctx, v)
|
||||
}
|
||||
|
||||
func (s *Service) monitorProcess(ctx context.Context, container *Container, process Process) {
|
||||
go func() {
|
||||
status, err := process.Wait()
|
||||
if err == nil {
|
||||
topic := GetContainerProcessEventTopic(container.ID(), process.ID())
|
||||
s.publishEvent(ctx, topic, &ContainerExitEvent{
|
||||
ContainerEvent: ContainerEvent{
|
||||
Timestamp: time.Now(),
|
||||
ID: container.ID(),
|
||||
Action: "exit",
|
||||
},
|
||||
PID: process.ID(),
|
||||
StatusCode: status,
|
||||
})
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func GetContainerEventTopic(id string) string {
|
||||
return fmt.Sprintf(containerEventsTopicFormat, id)
|
||||
}
|
||||
|
||||
func GetContainerProcessEventTopic(containerID, processID string) string {
|
||||
return fmt.Sprintf(containerProcessEventsTopicFormat, containerID, processID)
|
||||
}
|
||||
|
||||
func toGRPCContainer(container *Container) *api.Container {
|
||||
c := &api.Container{
|
||||
ID: container.ID(),
|
||||
BundlePath: container.Bundle(),
|
||||
}
|
||||
status := container.Status()
|
||||
switch status {
|
||||
case "created":
|
||||
c.Status = api.Status_CREATED
|
||||
case "running":
|
||||
c.Status = api.Status_RUNNING
|
||||
case "stopped":
|
||||
c.Status = api.Status_STOPPED
|
||||
case "paused":
|
||||
c.Status = api.Status_PAUSED
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func toGRPCProcesses(processes []Process) []*api.Process {
|
||||
var out []*api.Process
|
||||
for _, p := range processes {
|
||||
out = append(out, toGRPCProcess(p))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func toGRPCProcess(process Process) *api.Process {
|
||||
return &api.Process{
|
||||
ID: process.ID(),
|
||||
Pid: process.Pid(),
|
||||
}
|
||||
}
|
|
@ -120,6 +120,14 @@ func (p *initProcess) Resize(ws console.WinSize) error {
|
|||
return p.console.Resize(ws)
|
||||
}
|
||||
|
||||
func (p *initProcess) Pause(context context.Context) error {
|
||||
return p.runc.Pause(context, p.id)
|
||||
}
|
||||
|
||||
func (p *initProcess) Resume(context context.Context) error {
|
||||
return p.runc.Resume(context, p.id)
|
||||
}
|
||||
|
||||
func (p *initProcess) killAll(context context.Context) error {
|
||||
return p.runc.Kill(context, p.id, int(syscall.SIGKILL), &runc.KillOpts{
|
||||
All: true,
|
||||
|
|
|
@ -14,8 +14,8 @@ import (
|
|||
|
||||
var emptyResponse = &google_protobuf.Empty{}
|
||||
|
||||
// NewService returns a new shim service that can be used via GRPC
|
||||
func NewService() *Service {
|
||||
// New returns a new shim service that can be used via GRPC
|
||||
func New() *Service {
|
||||
return &Service{
|
||||
processes: make(map[int]process),
|
||||
events: make(chan *apishim.Event, 4096),
|
||||
|
@ -43,7 +43,7 @@ func (s *Service) Create(ctx context.Context, r *apishim.CreateRequest) (*apishi
|
|||
s.id = r.ID
|
||||
s.mu.Unlock()
|
||||
s.events <- &apishim.Event{
|
||||
Type: apishim.EventType_CREATED,
|
||||
Type: apishim.EventType_CREATE,
|
||||
ID: r.ID,
|
||||
Pid: uint32(pid),
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ func (s *Service) Start(ctx context.Context, r *apishim.StartRequest) (*google_p
|
|||
return nil, err
|
||||
}
|
||||
s.events <- &apishim.Event{
|
||||
Type: apishim.EventType_STARTED,
|
||||
Type: apishim.EventType_START,
|
||||
ID: s.id,
|
||||
Pid: uint32(s.initProcess.Pid()),
|
||||
}
|
||||
|
@ -154,6 +154,20 @@ func (s *Service) State(ctx context.Context, r *apishim.StateRequest) (*apishim.
|
|||
return o, nil
|
||||
}
|
||||
|
||||
func (s *Service) Pause(ctx context.Context, r *apishim.PauseRequest) (*google_protobuf.Empty, error) {
|
||||
if err := s.initProcess.Pause(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return emptyResponse, nil
|
||||
}
|
||||
|
||||
func (s *Service) Resume(ctx context.Context, r *apishim.ResumeRequest) (*google_protobuf.Empty, error) {
|
||||
if err := s.initProcess.Resume(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return emptyResponse, nil
|
||||
}
|
||||
|
||||
func (s *Service) ProcessExit(e utils.Exit) error {
|
||||
s.mu.Lock()
|
||||
if p, ok := s.processes[e.Pid]; ok {
|
||||
|
|
215
supervisor/service.go
Normal file
215
supervisor/service.go
Normal file
|
@ -0,0 +1,215 @@
|
|||
package supervisor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
api "github.com/docker/containerd/api/execution"
|
||||
"github.com/docker/containerd/api/shim"
|
||||
google_protobuf "github.com/golang/protobuf/ptypes/empty"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var (
|
||||
_ = (api.ExecutionServiceServer)(&Service{})
|
||||
empty = &google_protobuf.Empty{}
|
||||
)
|
||||
|
||||
// New creates a new GRPC services for execution
|
||||
func New(ctx context.Context, root string) (*Service, error) {
|
||||
clients, err := loadClients(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s := &Service{
|
||||
root: root,
|
||||
shims: clients,
|
||||
}
|
||||
for _, c := range clients {
|
||||
if err := s.monitor(c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
mu sync.Mutex
|
||||
|
||||
root string
|
||||
shims map[string]shim.ShimClient
|
||||
}
|
||||
|
||||
func (s *Service) Create(ctx context.Context, r *api.CreateContainerRequest) (*api.CreateContainerResponse, error) {
|
||||
s.mu.Lock()
|
||||
if _, ok := s.shims[r.ID]; ok {
|
||||
s.mu.Unlock()
|
||||
return nil, fmt.Errorf("container already exists %q", r.ID)
|
||||
}
|
||||
client, err := newShimClient(filepath.Join(s.root, r.ID))
|
||||
if err != nil {
|
||||
s.mu.Unlock()
|
||||
return nil, err
|
||||
}
|
||||
s.shims[r.ID] = client
|
||||
s.mu.Unlock()
|
||||
if err := s.monitor(client); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
createResponse, err := client.Create(ctx, &shim.CreateRequest{
|
||||
ID: r.ID,
|
||||
Bundle: r.BundlePath,
|
||||
Terminal: r.Console,
|
||||
Stdin: r.Stdin,
|
||||
Stdout: r.Stdout,
|
||||
Stderr: r.Stderr,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &api.CreateContainerResponse{
|
||||
Container: &api.Container{
|
||||
ID: r.ID,
|
||||
},
|
||||
InitProcess: &api.Process{
|
||||
Pid: createResponse.Pid,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Service) Start(ctx context.Context, r *api.StartContainerRequest) (*google_protobuf.Empty, error) {
|
||||
client, err := s.getShim(r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err := client.Start(ctx, &shim.StartRequest{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return empty, nil
|
||||
}
|
||||
|
||||
func (s *Service) Delete(ctx context.Context, r *api.DeleteContainerRequest) (*google_protobuf.Empty, error) {
|
||||
client, err := s.getShim(r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = client.Delete(ctx, &shim.DeleteRequest{
|
||||
Pid: r.Pid,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return empty, nil
|
||||
}
|
||||
|
||||
func (s *Service) List(ctx context.Context, r *api.ListContainersRequest) (*api.ListContainersResponse, error) {
|
||||
resp := &api.ListContainersResponse{}
|
||||
for _, client := range s.shims {
|
||||
status, err := client.State(ctx, &shim.StateRequest{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Containers = append(resp.Containers, &api.Container{
|
||||
ID: status.ID,
|
||||
Bundle: status.Bundle,
|
||||
})
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
func (s *Service) Get(ctx context.Context, r *api.GetContainerRequest) (*api.GetContainerResponse, error) {
|
||||
client, err := s.getShim(r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
state, err := client.State(ctx, &shim.StateRequest{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &api.GetContainerResponse{
|
||||
Container: &api.Container{
|
||||
ID: state.ID,
|
||||
Bundle: state.Bundle,
|
||||
// TODO: add processes
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Service) Update(ctx context.Context, r *api.UpdateContainerRequest) (*google_protobuf.Empty, error) {
|
||||
panic("not implemented")
|
||||
return empty, nil
|
||||
}
|
||||
|
||||
func (s *Service) Pause(ctx context.Context, r *api.PauseContainerRequest) (*google_protobuf.Empty, error) {
|
||||
client, err := s.getShim(r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client.Pause(ctx, &shim.PauseRequest{})
|
||||
}
|
||||
|
||||
func (s *Service) Resume(ctx context.Context, r *api.ResumeContainerRequest) (*google_protobuf.Empty, error) {
|
||||
client, err := s.getShim(r.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client.Resume(ctx, &shim.ResumeRequest{})
|
||||
}
|
||||
|
||||
func (s *Service) StartProcess(ctx context.Context, r *api.StartProcessRequest) (*api.StartProcessResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// containerd managed execs + system pids forked in container
|
||||
func (s *Service) GetProcess(ctx context.Context, r *api.GetProcessRequest) (*api.GetProcessResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (s *Service) SignalProcess(ctx context.Context, r *api.SignalProcessRequest) (*google_protobuf.Empty, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest) (*google_protobuf.Empty, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (s *Service) ListProcesses(ctx context.Context, r *api.ListProcessesRequest) (*api.ListProcessesResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// monitor monitors the shim's event rpc and forwards container and process
|
||||
// events to callers
|
||||
func (s *Service) monitor(client shim.ShimClient) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Service) getShim(id string) (shim.ShimClient, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
client, ok := s.shims[id]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("container does not exist %q", id)
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func loadClients(root string) (map[string]shim.ShimClient, error) {
|
||||
files, err := ioutil.ReadDir(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out := make(map[string]shim.ShimClient)
|
||||
for _, f := range files {
|
||||
if !f.IsDir() {
|
||||
continue
|
||||
}
|
||||
socket := filepath.Join(root, f.Name(), "shim.sock")
|
||||
client, err := connectToShim(socket)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out[f.Name()] = client
|
||||
}
|
||||
return out, nil
|
||||
}
|
44
supervisor/shim.go
Normal file
44
supervisor/shim.go
Normal file
|
@ -0,0 +1,44 @@
|
|||
package supervisor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/docker/containerd/api/shim"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
func newShimClient(root string) (shim.ShimClient, error) {
|
||||
// TODO: start the shim process
|
||||
cmd := exec.Command("containerd-shim")
|
||||
if err := cmd.Start(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cmd.Dir = root
|
||||
|
||||
socket := filepath.Join(root, "shim.sock")
|
||||
return connectToShim(socket)
|
||||
}
|
||||
|
||||
func connectToShim(socket string) (shim.ShimClient, error) {
|
||||
// reset the logger for grpc to log to dev/null so that it does not mess with our stdio
|
||||
grpclog.SetLogger(log.New(ioutil.Discard, "", log.LstdFlags))
|
||||
dialOpts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithTimeout(100 * time.Second)}
|
||||
dialOpts = append(dialOpts,
|
||||
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
|
||||
return net.DialTimeout("unix", socket, timeout)
|
||||
},
|
||||
))
|
||||
// FIXME: probably need a retry here
|
||||
conn, err := grpc.Dial(fmt.Sprintf("unix://%s", socket), dialOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return shim.NewShimClient(conn), nil
|
||||
}
|
Loading…
Reference in a new issue