diff --git a/api/services/execution/execution.pb.go b/api/services/execution/execution.pb.go index 6755c0c..7a0e78b 100644 --- a/api/services/execution/execution.pb.go +++ b/api/services/execution/execution.pb.go @@ -21,6 +21,8 @@ EventsRequest ExecRequest ExecResponse + PtyRequest + CloseStdinRequest */ package execution @@ -164,6 +166,26 @@ func (m *ExecResponse) Reset() { *m = ExecResponse{} } func (*ExecResponse) ProtoMessage() {} func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{11} } +type PtyRequest 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"` + Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"` + Height uint32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *PtyRequest) Reset() { *m = PtyRequest{} } +func (*PtyRequest) ProtoMessage() {} +func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{12} } + +type CloseStdinRequest 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 *CloseStdinRequest) Reset() { *m = CloseStdinRequest{} } +func (*CloseStdinRequest) ProtoMessage() {} +func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{13} } + func init() { proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.CreateRequest") proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.CreateResponse") @@ -177,6 +199,8 @@ func init() { proto.RegisterType((*EventsRequest)(nil), "containerd.v1.services.EventsRequest") proto.RegisterType((*ExecRequest)(nil), "containerd.v1.services.ExecRequest") proto.RegisterType((*ExecResponse)(nil), "containerd.v1.services.ExecResponse") + proto.RegisterType((*PtyRequest)(nil), "containerd.v1.services.PtyRequest") + proto.RegisterType((*CloseStdinRequest)(nil), "containerd.v1.services.CloseStdinRequest") } // Reference imports to suppress errors if they are not otherwise used. @@ -198,6 +222,8 @@ type ContainerServiceClient interface { Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, error) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) + Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) } type containerServiceClient struct { @@ -303,6 +329,24 @@ func (c *containerServiceClient) Exec(ctx context.Context, in *ExecRequest, opts return out, nil } +func (c *containerServiceClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + out := new(google_protobuf.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Pty", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + out := new(google_protobuf.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/CloseStdin", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for ContainerService service type ContainerServiceServer interface { @@ -314,6 +358,8 @@ type ContainerServiceServer interface { Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) Events(*EventsRequest, ContainerService_EventsServer) error Exec(context.Context, *ExecRequest) (*ExecResponse, error) + Pty(context.Context, *PtyRequest) (*google_protobuf.Empty, error) + CloseStdin(context.Context, *CloseStdinRequest) (*google_protobuf.Empty, error) } func RegisterContainerServiceServer(s *grpc.Server, srv ContainerServiceServer) { @@ -467,6 +513,42 @@ func _ContainerService_Exec_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _ContainerService_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PtyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Pty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.ContainerService/Pty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Pty(ctx, req.(*PtyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_CloseStdin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStdinRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).CloseStdin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.ContainerService/CloseStdin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).CloseStdin(ctx, req.(*CloseStdinRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _ContainerService_serviceDesc = grpc.ServiceDesc{ ServiceName: "containerd.v1.services.ContainerService", HandlerType: (*ContainerServiceServer)(nil), @@ -499,6 +581,14 @@ var _ContainerService_serviceDesc = grpc.ServiceDesc{ MethodName: "Exec", Handler: _ContainerService_Exec_Handler, }, + { + MethodName: "Pty", + Handler: _ContainerService_Pty_Handler, + }, + { + MethodName: "CloseStdin", + Handler: _ContainerService_CloseStdin_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -910,6 +1000,74 @@ func (m *ExecResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *PtyRequest) 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 *PtyRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + 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)) + } + if m.Width != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintExecution(dAtA, i, uint64(m.Width)) + } + if m.Height != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintExecution(dAtA, i, uint64(m.Height)) + } + return i, nil +} + +func (m *CloseStdinRequest) 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 *CloseStdinRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + 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 +} + func encodeFixed64Execution(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -1110,6 +1268,38 @@ func (m *ExecResponse) Size() (n int) { return n } +func (m *PtyRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovExecution(uint64(m.Pid)) + } + if m.Width != 0 { + n += 1 + sovExecution(uint64(m.Width)) + } + if m.Height != 0 { + n += 1 + sovExecution(uint64(m.Height)) + } + return n +} + +func (m *CloseStdinRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovExecution(uint64(m.Pid)) + } + return n +} + func sovExecution(x uint64) (n int) { for { n++ @@ -1257,6 +1447,30 @@ func (this *ExecResponse) String() string { }, "") return s } +func (this *PtyRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PtyRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `Width:` + fmt.Sprintf("%v", this.Width) + `,`, + `Height:` + fmt.Sprintf("%v", this.Height) + `,`, + `}`, + }, "") + return s +} +func (this *CloseStdinRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CloseStdinRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `}`, + }, "") + return s +} func valueToStringExecution(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -2564,6 +2778,240 @@ func (m *ExecResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *PtyRequest) 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 ErrIntOverflowExecution + } + 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: PtyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PtyRequest: 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 ErrIntOverflowExecution + } + 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 ErrInvalidLengthExecution + } + 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 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 + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Width", wireType) + } + m.Width = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Width |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CloseStdinRequest) 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 ErrIntOverflowExecution + } + 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: CloseStdinRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CloseStdinRequest: 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 ErrIntOverflowExecution + } + 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 ErrInvalidLengthExecution + } + 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 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:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipExecution(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -2674,49 +3122,53 @@ func init() { } var fileDescriptorExecution = []byte{ - // 691 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00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x21, 0xb4, 0x25, 0xc7, 0x68, 0x4f, 0x15, 0x50, 0xc6, - 0xdc, 0xea, 0xfe, 0x56, 0xda, 0x50, 0xbc, 0x84, 0x22, 0xbf, 0x8c, 0x5e, 0x75, 0x7e, 0x95, 0x35, - 0x50, 0xe7, 0x77, 0x67, 0x09, 0x4e, 0xa1, 0x25, 0x58, 0x46, 0x0f, 0x54, 0xfe, 0x25, 0xd2, 0xad, - 0x1a, 0x3c, 0xd1, 0x5b, 0x68, 0x09, 0xc4, 0xd5, 0x87, 0x95, 0xf6, 0xc1, 0xda, 0xfb, 0xb3, 0x53, - 0x9e, 0xdf, 0x11, 0xb4, 0x04, 0xe5, 0xea, 0x23, 0x4b, 0x3b, 0xa0, 0xec, 0xde, 0x19, 0xe8, 0x19, - 0xd9, 0xea, 0xee, 0x55, 0xc8, 0xb7, 0x56, 0xbf, 0xac, 0xd2, 0xe7, 0x91, 0x26, 0xca, 0x14, 0x8c, - 0xa9, 0x73, 0x2a, 0x2d, 0x8d, 0xba, 0xcc, 0x32, 0xa6, 0x87, 0xe6, 0xcd, 0xad, 0xbd, 0xf6, 0xfd, - 0xd6, 0x5e, 0xfb, 0x34, 0xb7, 0xb5, 0x9b, 0xb9, 0xad, 0x7d, 0x9b, 0xdb, 0xda, 0xcf, 0xb9, 0xad, - 0x5d, 0xe8, 0xb2, 0x96, 0x27, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x69, 0x61, 0x1c, 0xa9, 0x84, - 0x07, 0x00, 0x00, + // 763 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6f, 0xd3, 0x4a, + 0x10, 0xaf, 0xf3, 0xc7, 0xed, 0x9b, 0x34, 0x7d, 0x7d, 0xab, 0x2a, 0xf2, 0x33, 0x52, 0x1a, 0x99, + 0xb6, 0x84, 0x8b, 0x03, 0xe1, 0x86, 0x00, 0xa9, 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5, 0x17, 0x9e, 0x1c, 0x73, + 0x2f, 0x2f, 0x2d, 0x21, 0xa9, 0x0b, 0xe5, 0x58, 0x6c, 0x68, 0x47, 0x55, 0x90, 0xd5, 0xa2, 0x59, + 0xbb, 0xc3, 0x7f, 0x57, 0x3c, 0xd7, 0xa2, 0x3f, 0x29, 0x31, 0x75, 0x7f, 0x0b, 0x5a, 0x55, 0xf7, + 0x77, 0x4b, 0xa9, 0xc7, 0x50, 0x12, 0x82, 0x43, 0x0f, 0x55, 0xf9, 0x19, 0x39, 0x9a, 0x39, 0x1a, + 0x42, 0xef, 0xa0, 0x24, 0x74, 0xa8, 0x3e, 0x2c, 0x23, 0x5a, 0x73, 0xe7, 0xcf, 0x49, 0x49, 0x7f, + 0x1d, 0x28, 0x09, 0x29, 0xaa, 0x8f, 0xcc, 0x08, 0x55, 0xc9, 0xde, 0x09, 0xe8, 0x52, 0x7e, 0x6a, + 0xf6, 0x16, 0xe4, 0x69, 0x2e, 0x7f, 0xfe, 0xe3, 0x9c, 0x27, 0x9a, 0x80, 0x29, 0x84, 0xa0, 0xee, + 0x29, 0xa3, 0x6c, 0x35, 0xcc, 0x05, 0x2d, 0xed, 0x43, 0xf1, 0x8c, 0x4f, 0x90, 0xa5, 0x4a, 0x9e, + 0xcb, 0x4a, 0x09, 0xf2, 0x14, 0x60, 0x2e, 0x0b, 0xf4, 0x58, 0xb9, 0x9f, 0xb7, 0xa5, 0xa3, 0x3a, + 0xf0, 0xc0, 0xb8, 0xbe, 0xa9, 0xaf, 0xfc, 0xb8, 0xa9, 0xaf, 0x7c, 0x9e, 0xd6, 0xb5, 0xeb, 0x69, + 0x5d, 0xfb, 0x3e, 0xad, 0x6b, 0xbf, 0xa6, 0x75, 0xed, 0x5c, 0x8f, 0x33, 0x9f, 0xfd, 0x0e, 0x00, + 0x00, 0xff, 0xff, 0x98, 0xf8, 0x83, 0xab, 0xbd, 0x08, 0x00, 0x00, } diff --git a/api/services/execution/execution.proto b/api/services/execution/execution.proto index 060c30e..d7f2541 100644 --- a/api/services/execution/execution.proto +++ b/api/services/execution/execution.proto @@ -17,6 +17,8 @@ service ContainerService { rpc Kill(KillRequest) returns (google.protobuf.Empty); rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); rpc Exec(ExecRequest) returns (ExecResponse); + rpc Pty(PtyRequest) returns (google.protobuf.Empty); + rpc CloseStdin(CloseStdinRequest) returns (google.protobuf.Empty); } message CreateRequest { @@ -80,3 +82,15 @@ message ExecRequest { message ExecResponse { uint32 pid = 1; } + +message PtyRequest { + string id = 1 [(gogoproto.customname) = "ID"]; + uint32 pid = 2; + uint32 width = 3; + uint32 height = 4; +} + +message CloseStdinRequest { + string id = 1 [(gogoproto.customname) = "ID"]; + uint32 pid = 2; +} diff --git a/api/services/shim/shim.pb.go b/api/services/shim/shim.pb.go index bb41657..81d6174 100644 --- a/api/services/shim/shim.pb.go +++ b/api/services/shim/shim.pb.go @@ -25,6 +25,7 @@ ResumeRequest ExitRequest KillRequest + CloseStdinRequest */ package shim @@ -202,6 +203,14 @@ func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} } +type CloseStdinRequest struct { + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` +} + +func (m *CloseStdinRequest) Reset() { *m = CloseStdinRequest{} } +func (*CloseStdinRequest) ProtoMessage() {} +func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} } + func init() { proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.shim.CreateRequest") proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.shim.CreateResponse") @@ -219,6 +228,7 @@ func init() { proto.RegisterType((*ResumeRequest)(nil), "containerd.v1.services.shim.ResumeRequest") proto.RegisterType((*ExitRequest)(nil), "containerd.v1.services.shim.ExitRequest") proto.RegisterType((*KillRequest)(nil), "containerd.v1.services.shim.KillRequest") + proto.RegisterType((*CloseStdinRequest)(nil), "containerd.v1.services.shim.CloseStdinRequest") } // Reference imports to suppress errors if they are not otherwise used. @@ -232,17 +242,35 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Shim service type ShimClient interface { + // container rpcs + // Create will create the container within the runtime. At this point in time the container + // should be created along with its resources without its user defined process being started Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) + // Start executes the user defined process of the container Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // Delete removes the container and its resources from the runtime after it has been stopped Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) - Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error) + // State returns the state of the container that the shim owns and its additional processes State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) + // Pause pauses the container Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // Resume resumes a paused container back into a running state Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // shim rpcs + // Exit causes the shim to reap all remaining processes and exit Exit(ctx context.Context, in *ExitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // Events returns all events for the container owned by the shim including + // additional processes being added and removed and state changes + Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error) + // process rpcs + // Kill kills a container process owned by the shim Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // Exec adds and additional process to the container + Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) + // Pty handles resizing the pty/console for a container + Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // CloseStdin closes the STDIN for a process that is owned by the shim + CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } type shimClient struct { @@ -280,56 +308,6 @@ func (c *shimClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc return out, nil } -func (c *shimClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) { - out := new(ExecResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/Exec", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *shimClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { - out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/Pty", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *shimClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Shim_serviceDesc.Streams[0], c.cc, "/containerd.v1.services.shim.Shim/Events", opts...) - if err != nil { - return nil, err - } - x := &shimEventsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Shim_EventsClient interface { - Recv() (*containerd_v1_types1.Event, error) - grpc.ClientStream -} - -type shimEventsClient struct { - grpc.ClientStream -} - -func (x *shimEventsClient) Recv() (*containerd_v1_types1.Event, error) { - m := new(containerd_v1_types1.Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func (c *shimClient) State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) { out := new(StateResponse) err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/State", in, out, c.cc, opts...) @@ -366,6 +344,38 @@ func (c *shimClient) Exit(ctx context.Context, in *ExitRequest, opts ...grpc.Cal return out, nil } +func (c *shimClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Shim_serviceDesc.Streams[0], c.cc, "/containerd.v1.services.shim.Shim/Events", opts...) + if err != nil { + return nil, err + } + x := &shimEventsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Shim_EventsClient interface { + Recv() (*containerd_v1_types1.Event, error) + grpc.ClientStream +} + +type shimEventsClient struct { + grpc.ClientStream +} + +func (x *shimEventsClient) Recv() (*containerd_v1_types1.Event, error) { + m := new(containerd_v1_types1.Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + func (c *shimClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/Kill", in, out, c.cc, opts...) @@ -375,20 +385,65 @@ func (c *shimClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.Cal return out, nil } +func (c *shimClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) { + out := new(ExecResponse) + err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/Exec", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *shimClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/Pty", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *shimClient) CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.services.shim.Shim/CloseStdin", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for Shim service type ShimServer interface { + // container rpcs + // Create will create the container within the runtime. At this point in time the container + // should be created along with its resources without its user defined process being started Create(context.Context, *CreateRequest) (*CreateResponse, error) + // Start executes the user defined process of the container Start(context.Context, *StartRequest) (*google_protobuf1.Empty, error) + // Delete removes the container and its resources from the runtime after it has been stopped Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - Exec(context.Context, *ExecRequest) (*ExecResponse, error) - Pty(context.Context, *PtyRequest) (*google_protobuf1.Empty, error) - Events(*EventsRequest, Shim_EventsServer) error + // State returns the state of the container that the shim owns and its additional processes State(context.Context, *StateRequest) (*StateResponse, error) + // Pause pauses the container Pause(context.Context, *PauseRequest) (*google_protobuf1.Empty, error) + // Resume resumes a paused container back into a running state Resume(context.Context, *ResumeRequest) (*google_protobuf1.Empty, error) + // shim rpcs + // Exit causes the shim to reap all remaining processes and exit Exit(context.Context, *ExitRequest) (*google_protobuf1.Empty, error) + // Events returns all events for the container owned by the shim including + // additional processes being added and removed and state changes + Events(*EventsRequest, Shim_EventsServer) error + // process rpcs + // Kill kills a container process owned by the shim Kill(context.Context, *KillRequest) (*google_protobuf1.Empty, error) + // Exec adds and additional process to the container + Exec(context.Context, *ExecRequest) (*ExecResponse, error) + // Pty handles resizing the pty/console for a container + Pty(context.Context, *PtyRequest) (*google_protobuf1.Empty, error) + // CloseStdin closes the STDIN for a process that is owned by the shim + CloseStdin(context.Context, *CloseStdinRequest) (*google_protobuf1.Empty, error) } func RegisterShimServer(s *grpc.Server, srv ShimServer) { @@ -449,63 +504,6 @@ func _Shim_Delete_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } -func _Shim_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExecRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ShimServer).Exec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.v1.services.shim.Shim/Exec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Exec(ctx, req.(*ExecRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Shim_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PtyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ShimServer).Pty(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.v1.services.shim.Shim/Pty", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ShimServer).Pty(ctx, req.(*PtyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Shim_Events_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(EventsRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ShimServer).Events(m, &shimEventsServer{stream}) -} - -type Shim_EventsServer interface { - Send(*containerd_v1_types1.Event) error - grpc.ServerStream -} - -type shimEventsServer struct { - grpc.ServerStream -} - -func (x *shimEventsServer) Send(m *containerd_v1_types1.Event) error { - return x.ServerStream.SendMsg(m) -} - func _Shim_State_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StateRequest) if err := dec(in); err != nil { @@ -578,6 +576,27 @@ func _Shim_Exit_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +func _Shim_Events_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(EventsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ShimServer).Events(m, &shimEventsServer{stream}) +} + +type Shim_EventsServer interface { + Send(*containerd_v1_types1.Event) error + grpc.ServerStream +} + +type shimEventsServer struct { + grpc.ServerStream +} + +func (x *shimEventsServer) Send(m *containerd_v1_types1.Event) error { + return x.ServerStream.SendMsg(m) +} + func _Shim_Kill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(KillRequest) if err := dec(in); err != nil { @@ -596,6 +615,60 @@ func _Shim_Kill_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +func _Shim_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExecRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShimServer).Exec(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.shim.Shim/Exec", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShimServer).Exec(ctx, req.(*ExecRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Shim_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PtyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShimServer).Pty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.shim.Shim/Pty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShimServer).Pty(ctx, req.(*PtyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Shim_CloseStdin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStdinRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShimServer).CloseStdin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.shim.Shim/CloseStdin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShimServer).CloseStdin(ctx, req.(*CloseStdinRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Shim_serviceDesc = grpc.ServiceDesc{ ServiceName: "containerd.v1.services.shim.Shim", HandlerType: (*ShimServer)(nil), @@ -612,14 +685,6 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ MethodName: "Delete", Handler: _Shim_Delete_Handler, }, - { - MethodName: "Exec", - Handler: _Shim_Exec_Handler, - }, - { - MethodName: "Pty", - Handler: _Shim_Pty_Handler, - }, { MethodName: "State", Handler: _Shim_State_Handler, @@ -640,6 +705,18 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ MethodName: "Kill", Handler: _Shim_Kill_Handler, }, + { + MethodName: "Exec", + Handler: _Shim_Exec_Handler, + }, + { + MethodName: "Pty", + Handler: _Shim_Pty_Handler, + }, + { + MethodName: "CloseStdin", + Handler: _Shim_CloseStdin_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -1150,6 +1227,29 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *CloseStdinRequest) 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 *CloseStdinRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Pid != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.Pid)) + } + return i, nil +} + func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -1388,6 +1488,15 @@ func (m *KillRequest) Size() (n int) { return n } +func (m *CloseStdinRequest) Size() (n int) { + var l int + _ = l + if m.Pid != 0 { + n += 1 + sovShim(uint64(m.Pid)) + } + return n +} + func sovShim(x uint64) (n int) { for { n++ @@ -1577,6 +1686,16 @@ func (this *KillRequest) String() string { }, "") return s } +func (this *CloseStdinRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CloseStdinRequest{`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `}`, + }, "") + return s +} func valueToStringShim(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -3155,6 +3274,75 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *CloseStdinRequest) 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: CloseStdinRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CloseStdinRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 + } + } + 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 @@ -3265,58 +3453,60 @@ func init() { } var fileDescriptorShim = []byte{ - // 838 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x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 0xf3, 0xb9, 0x85, 0x7e, 0x56, 0x73, 0x12, 0xa4, 0x7d, 0x4e, 0x35, 0xb3, 0xcf, 0xf6, - 0x81, 0xd6, 0x7b, 0xa0, 0xd6, 0xbd, 0x25, 0xff, 0xba, 0x24, 0x1a, 0xfb, 0x7f, 0x0d, 0x8e, 0x96, - 0x4a, 0x4b, 0xff, 0x1b, 0x7a, 0x6a, 0xcc, 0xf6, 0x9d, 0x1c, 0x39, 0x15, 0xad, 0x23, 0xa7, 0x62, - 0x8f, 0x4c, 0x52, 0xa2, 0x2d, 0x99, 0xd6, 0x54, 0xdc, 0x94, 0xe9, 0xa5, 0xf7, 0xee, 0xfd, 0xe0, - 0xc1, 0x3f, 0xef, 0x07, 0x0f, 0x7e, 0x5b, 0x0e, 0xac, 0x77, 0xcb, 0x81, 0xf5, 0xf7, 0x72, 0x60, - 0xfd, 0xb7, 0x1c, 0x58, 0xd7, 0x8e, 0x42, 0xbe, 0xf8, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xab, - 0x2d, 0xf0, 0x3c, 0x09, 0x00, 0x00, + // 871 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x0e, 0x25, 0x99, 0x96, 0x47, 0xa1, 0xd3, 0x2e, 0x0c, 0x83, 0xa1, 0x0b, 0xc5, 0x25, 0x50, + 0x54, 0x49, 0x01, 0xaa, 0x51, 0x6e, 0x45, 0x7b, 0x68, 0x62, 0x17, 0x4d, 0x9b, 0x02, 0xc2, 0xba, + 0xb7, 0x02, 0x0d, 0x68, 0x71, 0x2d, 0x2d, 0x40, 0x72, 0x59, 0xee, 0xd2, 0x8d, 0x6e, 0x3d, 0xf7, + 0x0d, 0xfa, 0x3a, 0x3d, 0xe5, 0xd8, 0x63, 0x4f, 0x45, 0xa3, 0x77, 0xe8, 0xbd, 0xd8,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x10, 0xfa, 0x29, 0x7b, 0x9d, 0xd1, 0x6b, 0x26, 0xdc, 0xde, 0xa9, + 0x35, 0xea, 0xe3, 0xfd, 0x94, 0x4d, 0xa5, 0x8b, 0x3c, 0xe8, 0x0b, 0x92, 0x27, 0x34, 0x0d, 0x63, + 0x77, 0x4f, 0x7d, 0xaa, 0x7c, 0x74, 0x04, 0x7b, 0x5c, 0x44, 0x34, 0x75, 0x6d, 0x55, 0x4e, 0x3b, + 0xf2, 0x7a, 0x2e, 0x22, 0x56, 0x08, 0x77, 0x5f, 0x5f, 0xaf, 0x3d, 0x13, 0x27, 0x79, 0xee, 0xf6, + 0xab, 0x38, 0xc9, 0x73, 0x34, 0x01, 0x3b, 0x67, 0x4c, 0x5c, 0x71, 0xf7, 0xe0, 0xb4, 0x3b, 0x1a, + 0x4c, 0xbc, 0x60, 0x73, 0xb0, 0x8a, 0x98, 0xe0, 0x07, 0x49, 0x28, 0x36, 0x99, 0xbe, 0x0f, 0x87, + 0x25, 0x17, 0x3c, 0x63, 0x29, 0x27, 0xe8, 0x03, 0xe8, 0x66, 0x86, 0x0d, 0x07, 0x4b, 0xd3, 0x3f, + 0x84, 0xfb, 0x17, 0x22, 0xcc, 0x85, 0xa1, 0xcb, 0xff, 0x18, 0x9c, 0x33, 0x12, 0x93, 0x9a, 0xbf, + 0xdb, 0x47, 0x9e, 0xc2, 0x61, 0x99, 0x62, 0xca, 0x3e, 0x82, 0x01, 0x79, 0x43, 0xc5, 0x6b, 0x2e, + 0x42, 0x51, 0x70, 0x93, 0x0b, 0x32, 0x74, 0xa1, 0x22, 0xfe, 0x1f, 0x16, 0x0c, 0xce, 0xdf, 0x90, + 0x59, 0x59, 0x74, 0x9d, 0x2f, 0xab, 0x89, 0xaf, 0xce, 0xdd, 0x7c, 0x75, 0x1b, 0xf8, 0xea, 0x6d, + 0xf0, 0x35, 0x82, 0x1e, 0xcf, 0xc8, 0x4c, 0x4d, 0x63, 0x30, 0x39, 0x0a, 0xb4, 0x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xb8, 0xd5, 0x8b, 0xda, 0x08, 0xf2, 0x47, 0x80, + 0x7a, 0x91, 0x51, 0xb0, 0x7d, 0xe1, 0x6e, 0x6e, 0x7c, 0x53, 0xd5, 0xe7, 0xee, 0xdb, 0x77, 0xc3, + 0x7b, 0x7f, 0xbf, 0x1b, 0xde, 0xfb, 0x6d, 0x35, 0xb4, 0xde, 0xae, 0x86, 0xd6, 0x5f, 0xab, 0xa1, + 0xf5, 0xef, 0x6a, 0x68, 0x5d, 0xda, 0x2a, 0xf3, 0xd9, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x55, + 0x1a, 0x40, 0xbc, 0xb9, 0x09, 0x00, 0x00, } diff --git a/api/services/shim/shim.proto b/api/services/shim/shim.proto index 6013eeb..39ba062 100644 --- a/api/services/shim/shim.proto +++ b/api/services/shim/shim.proto @@ -8,18 +8,24 @@ import "gogoproto/gogo.proto"; import "github.com/containerd/containerd/api/types/mount/mount.proto"; import "github.com/containerd/containerd/api/types/container/container.proto"; +// Shim service is launched for each container and is responsible for owning the IO +// for the container and its additional processes. The shim is also the parent of +// each container and allows reattaching to the IO and receiving the exit status +// for the container processes. service Shim { rpc Create(CreateRequest) returns (CreateResponse); rpc Start(StartRequest) returns (google.protobuf.Empty); rpc Delete(DeleteRequest) returns (DeleteResponse); - rpc Exec(ExecRequest) returns (ExecResponse); - rpc Pty(PtyRequest) returns (google.protobuf.Empty); - rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); rpc State(StateRequest) returns (StateResponse); rpc Pause(PauseRequest) returns (google.protobuf.Empty); rpc Resume(ResumeRequest) returns (google.protobuf.Empty); + rpc Exit(ExitRequest) returns (google.protobuf.Empty); + rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); rpc Kill(KillRequest) returns (google.protobuf.Empty); + rpc Exec(ExecRequest) returns (ExecResponse); + rpc Pty(PtyRequest) returns (google.protobuf.Empty); + rpc CloseStdin(CloseStdinRequest) returns (google.protobuf.Empty); } message CreateRequest { @@ -87,7 +93,6 @@ message StateResponse { repeated containerd.v1.types.Process processes = 5; } - message PauseRequest { } @@ -102,3 +107,7 @@ message KillRequest { bool all = 2; uint32 pid = 3; } + +message CloseStdinRequest { + uint32 pid = 1; +} diff --git a/cmd/ctr/exec.go b/cmd/ctr/exec.go index 527f801..e2cd1e5 100644 --- a/cmd/ctr/exec.go +++ b/cmd/ctr/exec.go @@ -4,6 +4,7 @@ import ( gocontext "context" "os" + "github.com/Sirupsen/logrus" "github.com/containerd/containerd/api/services/execution" "github.com/crosbymichael/console" "github.com/urfave/cli" @@ -49,8 +50,9 @@ var execCommand = cli.Command{ if err != nil { return err } + var con console.Console if request.Terminal { - con := console.Current() + con = console.Current() defer con.Reset() if err := con.SetRaw(); err != nil { return err @@ -64,6 +66,12 @@ var execCommand = cli.Command{ if err != nil { return err } + if request.Terminal { + if err := handleConsoleResize(ctx, containers, id, response.Pid, con); err != nil { + logrus.WithError(err).Error("console resize") + } + } + // Ensure we read all io only if container started successfully. defer fwg.Wait() diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index 38235de..2c4d856 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -5,11 +5,14 @@ import ( "encoding/json" "fmt" "os" + "os/signal" "runtime" + "syscall" "google.golang.org/grpc" "google.golang.org/grpc/codes" + "github.com/Sirupsen/logrus" "github.com/containerd/containerd/api/services/execution" rootfsapi "github.com/containerd/containerd/api/services/rootfs" "github.com/containerd/containerd/images" @@ -143,8 +146,9 @@ var runCommand = cli.Command{ if resp != nil { create.Rootfs = resp.Mounts } + var con console.Console if create.Terminal { - con := console.Current() + con = console.Current() defer con.Reset() if err := con.SetRaw(); err != nil { return err @@ -159,12 +163,16 @@ var runCommand = cli.Command{ if err != nil { return err } + if create.Terminal { + if err := handleConsoleResize(ctx, containers, response.ID, response.Pid, con); err != nil { + logrus.WithError(err).Error("console resize") + } + } if _, err := containers.Start(ctx, &execution.StartRequest{ ID: response.ID, }); err != nil { return err } - // Ensure we read all io only if container started successfully. defer fwg.Wait() @@ -183,3 +191,39 @@ var runCommand = cli.Command{ return nil }, } + +func handleConsoleResize(ctx gocontext.Context, service execution.ContainerServiceClient, id string, pid uint32, con console.Console) error { + // do an initial resize of the console + size, err := con.Size() + if err != nil { + return err + } + if _, err := service.Pty(ctx, &execution.PtyRequest{ + ID: id, + Pid: pid, + Width: uint32(size.Width), + Height: uint32(size.Height), + }); err != nil { + return err + } + s := make(chan os.Signal, 16) + signal.Notify(s, syscall.SIGWINCH) + go func() { + for range s { + size, err := con.Size() + if err != nil { + logrus.WithError(err).Error("get pty size") + continue + } + if _, err := service.Pty(ctx, &execution.PtyRequest{ + ID: id, + Pid: pid, + Width: uint32(size.Width), + Height: uint32(size.Height), + }); err != nil { + logrus.WithError(err).Error("resize pty") + } + } + }() + return nil +} diff --git a/container.go b/container.go index cd0f098..e07e0a7 100644 --- a/container.go +++ b/container.go @@ -18,6 +18,10 @@ type Container interface { Kill(context.Context, uint32, bool) error // Exec adds a process into the container Exec(context.Context, ExecOpts) (Process, error) + // Pty resizes the processes pty/console + Pty(context.Context, uint32, ConsoleSize) error + // CloseStdin closes the processes stdin + CloseStdin(context.Context, uint32) error } type LinuxContainer interface { @@ -39,6 +43,11 @@ type Process interface { Kill(context.Context, uint32, bool) error } +type ConsoleSize struct { + Width uint32 + Height uint32 +} + type Status int const ( diff --git a/linux/container.go b/linux/container.go index 1de553c..94e9e64 100644 --- a/linux/container.go +++ b/linux/container.go @@ -24,6 +24,13 @@ func (s State) Status() containerd.Status { return s.status } +func newContainer(id string, shim shim.ShimClient) *Container { + return &Container{ + id: id, + shim: shim, + } +} + type Container struct { id string @@ -103,6 +110,21 @@ func (c *Container) Exec(ctx context.Context, opts containerd.ExecOpts) (contain c: c, }, nil } +func (c *Container) Pty(ctx context.Context, pid uint32, size containerd.ConsoleSize) error { + _, err := c.shim.Pty(ctx, &shim.PtyRequest{ + Pid: pid, + Width: size.Width, + Height: size.Height, + }) + return err +} + +func (c *Container) CloseStdin(ctx context.Context, pid uint32) error { + _, err := c.shim.CloseStdin(ctx, &shim.CloseStdinRequest{ + Pid: pid, + }) + return err +} type Process struct { pid int diff --git a/linux/runtime.go b/linux/runtime.go index 39d62b5..299c9fa 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -108,10 +108,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts containerd.CreateO os.RemoveAll(path) return nil, err } - c := &Container{ - id: id, - shim: s, - } + c := newContainer(id, s) // after the container is create add it to the monitor if err := r.monitor.Monitor(c); err != nil { return nil, err diff --git a/linux/shim/client.go b/linux/shim/client.go index 4d6c110..07922ed 100644 --- a/linux/shim/client.go +++ b/linux/shim/client.go @@ -74,6 +74,10 @@ func (c *client) Exit(ctx context.Context, in *shimapi.ExitRequest, opts ...grpc return empty, nil } +func (c *client) CloseStdin(ctx context.Context, in *shimapi.CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.CloseStdin(ctx, in) +} + type events struct { c chan *container.Event ctx context.Context diff --git a/linux/shim/exec.go b/linux/shim/exec.go index a224b0d..5dc99ca 100644 --- a/linux/shim/exec.go +++ b/linux/shim/exec.go @@ -28,6 +28,7 @@ type execProcess struct { status int pid int closers []io.Closer + stdin io.Closer parent *initProcess } @@ -78,6 +79,7 @@ func newExecProcess(context context.Context, path string, r *shimapi.ExecRequest return nil, err } e.closers = append(e.closers, sc) + e.stdin = sc } if socket != nil { console, err := socket.ReceiveMaster() @@ -145,3 +147,7 @@ func (e *execProcess) Resize(ws console.WinSize) error { func (e *execProcess) Signal(sig int) error { return syscall.Kill(e.pid, syscall.Signal(sig)) } + +func (e *execProcess) Stdin() io.Closer { + return e.stdin +} diff --git a/linux/shim/init.go b/linux/shim/init.go index 616b20a..8bcf4ba 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -28,6 +28,7 @@ type initProcess struct { status int pid int closers []io.Closer + stdin io.Closer } func newInitProcess(context context.Context, path string, r *shimapi.CreateRequest) (*initProcess, error) { @@ -83,6 +84,7 @@ func newInitProcess(context context.Context, path string, r *shimapi.CreateReque if err != nil { return nil, err } + p.stdin = sc p.closers = append(p.closers, sc) } if socket != nil { @@ -175,3 +177,7 @@ func (p *initProcess) killAll(context context.Context) error { func (p *initProcess) Signal(sig int) error { return syscall.Kill(p.pid, syscall.Signal(sig)) } + +func (p *initProcess) Stdin() io.Closer { + return p.stdin +} diff --git a/linux/shim/process.go b/linux/shim/process.go index f1d2f58..3b1e2a4 100644 --- a/linux/shim/process.go +++ b/linux/shim/process.go @@ -4,6 +4,7 @@ package shim import ( "context" + "io" "github.com/crosbymichael/console" ) @@ -21,4 +22,6 @@ type process interface { Delete(context.Context) error // Signal directly signals the process Signal(int) error + // Stdin returns the process STDIN + Stdin() io.Closer } diff --git a/linux/shim/service.go b/linux/shim/service.go index 96da164..cdaa833 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -233,6 +233,17 @@ func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_pro return empty, nil } +func (s *Service) CloseStdin(ctx context.Context, r *shimapi.CloseStdinRequest) (*google_protobuf.Empty, error) { + p, ok := s.processes[int(r.Pid)] + if !ok { + return nil, fmt.Errorf("process does not exist %d", r.Pid) + } + if err := p.Stdin().Close(); err != nil { + return nil, err + } + return empty, nil +} + func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) { status := <-cmd.ExitCh p.Exited(status) diff --git a/services/execution/service.go b/services/execution/service.go index 0d8fa4a..f6749de 100644 --- a/services/execution/service.go +++ b/services/execution/service.go @@ -226,6 +226,31 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecRequest) (*api.ExecRespon }, nil } +func (s *Service) Pty(ctx context.Context, r *api.PtyRequest) (*google_protobuf.Empty, error) { + c, err := s.getContainer(r.ID) + if err != nil { + return nil, err + } + if err := c.Pty(ctx, r.Pid, containerd.ConsoleSize{ + Width: r.Width, + Height: r.Height, + }); err != nil { + return nil, err + } + return empty, nil +} + +func (s *Service) CloseStdin(ctx context.Context, r *api.CloseStdinRequest) (*google_protobuf.Empty, error) { + c, err := s.getContainer(r.ID) + if err != nil { + return nil, err + } + if err := c.CloseStdin(ctx, r.Pid); err != nil { + return nil, err + } + return empty, nil +} + func (s *Service) getContainer(id string) (containerd.Container, error) { s.mu.Lock() c, ok := s.containers[id]