Merge pull request #565 from ijc25/execution-service-get-container-info
Add ContainerService.Info to get info about a single container
This commit is contained in:
commit
994aebc698
5 changed files with 291 additions and 57 deletions
|
@ -14,6 +14,7 @@
|
||||||
StartRequest
|
StartRequest
|
||||||
DeleteRequest
|
DeleteRequest
|
||||||
DeleteResponse
|
DeleteResponse
|
||||||
|
InfoRequest
|
||||||
ListRequest
|
ListRequest
|
||||||
ListResponse
|
ListResponse
|
||||||
EventsRequest
|
EventsRequest
|
||||||
|
@ -99,12 +100,20 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
|
||||||
func (*DeleteResponse) ProtoMessage() {}
|
func (*DeleteResponse) ProtoMessage() {}
|
||||||
func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{4} }
|
func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{4} }
|
||||||
|
|
||||||
|
type InfoRequest struct {
|
||||||
|
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *InfoRequest) Reset() { *m = InfoRequest{} }
|
||||||
|
func (*InfoRequest) ProtoMessage() {}
|
||||||
|
func (*InfoRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{5} }
|
||||||
|
|
||||||
type ListRequest struct {
|
type ListRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ListRequest) Reset() { *m = ListRequest{} }
|
func (m *ListRequest) Reset() { *m = ListRequest{} }
|
||||||
func (*ListRequest) ProtoMessage() {}
|
func (*ListRequest) ProtoMessage() {}
|
||||||
func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{5} }
|
func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{6} }
|
||||||
|
|
||||||
type ListResponse struct {
|
type ListResponse struct {
|
||||||
Containers []*containerd_v1_types1.Container `protobuf:"bytes,1,rep,name=containers" json:"containers,omitempty"`
|
Containers []*containerd_v1_types1.Container `protobuf:"bytes,1,rep,name=containers" json:"containers,omitempty"`
|
||||||
|
@ -112,14 +121,14 @@ type ListResponse struct {
|
||||||
|
|
||||||
func (m *ListResponse) Reset() { *m = ListResponse{} }
|
func (m *ListResponse) Reset() { *m = ListResponse{} }
|
||||||
func (*ListResponse) ProtoMessage() {}
|
func (*ListResponse) ProtoMessage() {}
|
||||||
func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{6} }
|
func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{7} }
|
||||||
|
|
||||||
type EventsRequest struct {
|
type EventsRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *EventsRequest) Reset() { *m = EventsRequest{} }
|
func (m *EventsRequest) Reset() { *m = EventsRequest{} }
|
||||||
func (*EventsRequest) ProtoMessage() {}
|
func (*EventsRequest) ProtoMessage() {}
|
||||||
func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{7} }
|
func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} }
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.CreateRequest")
|
proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.CreateRequest")
|
||||||
|
@ -127,6 +136,7 @@ func init() {
|
||||||
proto.RegisterType((*StartRequest)(nil), "containerd.v1.services.StartRequest")
|
proto.RegisterType((*StartRequest)(nil), "containerd.v1.services.StartRequest")
|
||||||
proto.RegisterType((*DeleteRequest)(nil), "containerd.v1.services.DeleteRequest")
|
proto.RegisterType((*DeleteRequest)(nil), "containerd.v1.services.DeleteRequest")
|
||||||
proto.RegisterType((*DeleteResponse)(nil), "containerd.v1.services.DeleteResponse")
|
proto.RegisterType((*DeleteResponse)(nil), "containerd.v1.services.DeleteResponse")
|
||||||
|
proto.RegisterType((*InfoRequest)(nil), "containerd.v1.services.InfoRequest")
|
||||||
proto.RegisterType((*ListRequest)(nil), "containerd.v1.services.ListRequest")
|
proto.RegisterType((*ListRequest)(nil), "containerd.v1.services.ListRequest")
|
||||||
proto.RegisterType((*ListResponse)(nil), "containerd.v1.services.ListResponse")
|
proto.RegisterType((*ListResponse)(nil), "containerd.v1.services.ListResponse")
|
||||||
proto.RegisterType((*EventsRequest)(nil), "containerd.v1.services.EventsRequest")
|
proto.RegisterType((*EventsRequest)(nil), "containerd.v1.services.EventsRequest")
|
||||||
|
@ -146,6 +156,7 @@ type ContainerServiceClient interface {
|
||||||
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
|
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
|
||||||
Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
|
Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
|
||||||
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
|
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
|
||||||
|
Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*containerd_v1_types1.Container, error)
|
||||||
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
|
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
|
||||||
Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, error)
|
Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, error)
|
||||||
}
|
}
|
||||||
|
@ -185,6 +196,15 @@ func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest,
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *containerServiceClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*containerd_v1_types1.Container, error) {
|
||||||
|
out := new(containerd_v1_types1.Container)
|
||||||
|
err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Info", in, out, c.cc, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
|
func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
|
||||||
out := new(ListResponse)
|
out := new(ListResponse)
|
||||||
err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/List", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/List", in, out, c.cc, opts...)
|
||||||
|
@ -232,6 +252,7 @@ type ContainerServiceServer interface {
|
||||||
Create(context.Context, *CreateRequest) (*CreateResponse, error)
|
Create(context.Context, *CreateRequest) (*CreateResponse, error)
|
||||||
Start(context.Context, *StartRequest) (*google_protobuf.Empty, error)
|
Start(context.Context, *StartRequest) (*google_protobuf.Empty, error)
|
||||||
Delete(context.Context, *DeleteRequest) (*google_protobuf.Empty, error)
|
Delete(context.Context, *DeleteRequest) (*google_protobuf.Empty, error)
|
||||||
|
Info(context.Context, *InfoRequest) (*containerd_v1_types1.Container, error)
|
||||||
List(context.Context, *ListRequest) (*ListResponse, error)
|
List(context.Context, *ListRequest) (*ListResponse, error)
|
||||||
Events(*EventsRequest, ContainerService_EventsServer) error
|
Events(*EventsRequest, ContainerService_EventsServer) error
|
||||||
}
|
}
|
||||||
|
@ -294,6 +315,24 @@ func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _ContainerService_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(InfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(ContainerServiceServer).Info(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/containerd.v1.services.ContainerService/Info",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(ContainerServiceServer).Info(ctx, req.(*InfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(ListRequest)
|
in := new(ListRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
|
@ -349,6 +388,10 @@ var _ContainerService_serviceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "Delete",
|
MethodName: "Delete",
|
||||||
Handler: _ContainerService_Delete_Handler,
|
Handler: _ContainerService_Delete_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Info",
|
||||||
|
Handler: _ContainerService_Info_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "List",
|
MethodName: "List",
|
||||||
Handler: _ContainerService_List_Handler,
|
Handler: _ContainerService_List_Handler,
|
||||||
|
@ -550,6 +593,30 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *InfoRequest) 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 *InfoRequest) 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)
|
||||||
|
}
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *ListRequest) Marshal() (dAtA []byte, err error) {
|
func (m *ListRequest) Marshal() (dAtA []byte, err error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
dAtA = make([]byte, size)
|
dAtA = make([]byte, size)
|
||||||
|
@ -728,6 +795,16 @@ func (m *DeleteResponse) Size() (n int) {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *InfoRequest) Size() (n int) {
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.ID)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovExecution(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func (m *ListRequest) Size() (n int) {
|
func (m *ListRequest) Size() (n int) {
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
@ -824,6 +901,16 @@ func (this *DeleteResponse) String() string {
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
func (this *InfoRequest) String() string {
|
||||||
|
if this == nil {
|
||||||
|
return "nil"
|
||||||
|
}
|
||||||
|
s := strings.Join([]string{`&InfoRequest{`,
|
||||||
|
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
|
||||||
|
`}`,
|
||||||
|
}, "")
|
||||||
|
return s
|
||||||
|
}
|
||||||
func (this *ListRequest) String() string {
|
func (this *ListRequest) String() string {
|
||||||
if this == nil {
|
if this == nil {
|
||||||
return "nil"
|
return "nil"
|
||||||
|
@ -1493,6 +1580,85 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *InfoRequest) 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: InfoRequest: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: InfoRequest: 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
|
||||||
|
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 *ListRequest) Unmarshal(dAtA []byte) error {
|
func (m *ListRequest) Unmarshal(dAtA []byte) error {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
@ -1784,41 +1950,42 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorExecution = []byte{
|
var fileDescriptorExecution = []byte{
|
||||||
// 569 bytes of a gzipped FileDescriptorProto
|
// 589 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xd3, 0x40,
|
||||||
0x10, 0xad, 0x93, 0xd6, 0x0d, 0x93, 0xa6, 0x54, 0xab, 0x28, 0x32, 0x46, 0x72, 0x23, 0x53, 0x4a,
|
0x10, 0xad, 0x93, 0xd4, 0x2d, 0x93, 0xa6, 0x54, 0xab, 0x2a, 0x32, 0x46, 0x72, 0x23, 0xd3, 0x96,
|
||||||
0x4e, 0x36, 0x84, 0x0b, 0xe2, 0x80, 0xa0, 0x69, 0x84, 0x2a, 0x51, 0x24, 0x9c, 0x03, 0x47, 0xe4,
|
0x9c, 0x6c, 0x08, 0x17, 0xc4, 0x01, 0x41, 0xd3, 0x08, 0x45, 0x50, 0x24, 0x9c, 0x03, 0x47, 0xe4,
|
||||||
0xd8, 0xd3, 0xb0, 0x22, 0xf1, 0x9a, 0xdd, 0x75, 0xd4, 0xdc, 0xe0, 0x87, 0xf0, 0x7f, 0x7a, 0xe4,
|
0xd8, 0x9b, 0xb0, 0x22, 0xd9, 0x35, 0xbb, 0xeb, 0xa8, 0xb9, 0xc1, 0xbf, 0xeb, 0x91, 0x23, 0x27,
|
||||||
0xc8, 0x09, 0xd1, 0xfc, 0x12, 0xe4, 0xb5, 0x9d, 0x0f, 0x88, 0x09, 0x17, 0x6b, 0xe6, 0xf9, 0xcd,
|
0x44, 0x73, 0xe4, 0x57, 0x20, 0xaf, 0xed, 0x7c, 0x40, 0x8c, 0xb9, 0x58, 0x33, 0xcf, 0x6f, 0x76,
|
||||||
0xf8, 0xcd, 0x1b, 0x0f, 0xf4, 0x46, 0x54, 0x7e, 0x4c, 0x86, 0x4e, 0xc0, 0x26, 0x6e, 0xc8, 0x82,
|
0x67, 0xde, 0xdb, 0x81, 0xee, 0x98, 0xc8, 0x8f, 0xf1, 0xd0, 0x09, 0xd8, 0xd4, 0x0d, 0x59, 0xf0,
|
||||||
0x4f, 0xc8, 0xdd, 0x80, 0x45, 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xbb, 0x8a, 0x07, 0xdd, 0xb0, 0xd3, 0xdc, 0xbe, 0xdd,
|
||||||
0xe7, 0x96, 0xf6, 0x6b, 0x6e, 0x69, 0x43, 0x5d, 0xcd, 0xf2, 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff,
|
0x8a, 0xf3, 0x48, 0xbb, 0x30, 0x6e, 0x6e, 0xad, 0x9d, 0xef, 0xb7, 0xd6, 0xce, 0x97, 0x85, 0xa5,
|
||||||
0xff, 0xb8, 0xe7, 0x52, 0x19, 0x35, 0x05, 0x00, 0x00,
|
0xdd, 0x2c, 0x2c, 0xed, 0xdb, 0xc2, 0xd2, 0x7e, 0x2e, 0x2c, 0x6d, 0xa8, 0x2b, 0x61, 0x9e, 0xfc,
|
||||||
|
0x0e, 0x00, 0x00, 0xff, 0xff, 0x81, 0xbf, 0xf2, 0x2b, 0xa9, 0x05, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ service ContainerService {
|
||||||
rpc Create(CreateRequest) returns (CreateResponse);
|
rpc Create(CreateRequest) returns (CreateResponse);
|
||||||
rpc Start(StartRequest) returns (google.protobuf.Empty);
|
rpc Start(StartRequest) returns (google.protobuf.Empty);
|
||||||
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
|
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
|
||||||
|
rpc Info(InfoRequest) returns (containerd.v1.types.Container);
|
||||||
rpc List(ListRequest) returns (ListResponse);
|
rpc List(ListRequest) returns (ListResponse);
|
||||||
rpc Events(EventsRequest) returns (stream containerd.v1.types.Event);
|
rpc Events(EventsRequest) returns (stream containerd.v1.types.Event);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +46,10 @@ message DeleteResponse {
|
||||||
uint32 exit_status = 2;
|
uint32 exit_status = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message InfoRequest {
|
||||||
|
string id = 1 [(gogoproto.customname) = "ID"];
|
||||||
|
}
|
||||||
|
|
||||||
message ListRequest {
|
message ListRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
44
cmd/ctr/info.go
Normal file
44
cmd/ctr/info.go
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
gocontext "context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/containerd/api/services/execution"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
var infoCommand = cli.Command{
|
||||||
|
Name: "info",
|
||||||
|
Usage: "get info about a container",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "id",
|
||||||
|
Usage: "id of the container",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: func(context *cli.Context) error {
|
||||||
|
id := context.String("id")
|
||||||
|
if id == "" {
|
||||||
|
return errors.New("container id must be provided")
|
||||||
|
}
|
||||||
|
|
||||||
|
containers, err := getExecutionService(context)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
response, err := containers.Info(gocontext.Background(), &execution.InfoRequest{ID: id})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
json, err := json.MarshalIndent(response, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println(string(json))
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
|
@ -44,6 +44,7 @@ containerd client
|
||||||
eventsCommand,
|
eventsCommand,
|
||||||
deleteCommand,
|
deleteCommand,
|
||||||
listCommand,
|
listCommand,
|
||||||
|
infoCommand,
|
||||||
shimCommand,
|
shimCommand,
|
||||||
pprofCommand,
|
pprofCommand,
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,15 +131,12 @@ func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*google_pro
|
||||||
return empty, nil
|
return empty, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) List(ctx context.Context, r *api.ListRequest) (*api.ListResponse, error) {
|
func containerFromContainerd(ctx context.Context, c containerd.Container) (*container.Container, error) {
|
||||||
resp := &api.ListResponse{}
|
|
||||||
s.mu.Lock()
|
|
||||||
defer s.mu.Unlock()
|
|
||||||
for _, c := range s.containers {
|
|
||||||
state, err := c.State(ctx)
|
state, err := c.State(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var status container.Status
|
var status container.Status
|
||||||
switch state.Status() {
|
switch state.Status() {
|
||||||
case containerd.CreatedStatus:
|
case containerd.CreatedStatus:
|
||||||
|
@ -151,11 +148,31 @@ func (s *Service) List(ctx context.Context, r *api.ListRequest) (*api.ListRespon
|
||||||
case containerd.PausedStatus:
|
case containerd.PausedStatus:
|
||||||
status = container.Status_PAUSED
|
status = container.Status_PAUSED
|
||||||
}
|
}
|
||||||
resp.Containers = append(resp.Containers, &container.Container{
|
return &container.Container{
|
||||||
ID: c.Info().ID,
|
ID: c.Info().ID,
|
||||||
Pid: state.Pid(),
|
Pid: state.Pid(),
|
||||||
Status: status,
|
Status: status,
|
||||||
})
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) Info(ctx context.Context, r *api.InfoRequest) (*container.Container, error) {
|
||||||
|
c, err := s.getContainer(r.ID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return containerFromContainerd(ctx, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) List(ctx context.Context, r *api.ListRequest) (*api.ListResponse, error) {
|
||||||
|
resp := &api.ListResponse{}
|
||||||
|
s.mu.Lock()
|
||||||
|
defer s.mu.Unlock()
|
||||||
|
for _, cd := range s.containers {
|
||||||
|
c, err := containerFromContainerd(ctx, cd)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
resp.Containers = append(resp.Containers, c)
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue