diff --git a/api/services/content/content.pb.go b/api/services/content/content.pb.go index d42341c..0346b12 100644 --- a/api/services/content/content.pb.go +++ b/api/services/content/content.pb.go @@ -2588,7 +2588,7 @@ func init() { var fileDescriptorContent = []byte{ // 768 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6f, 0xd3, 0x4e, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6f, 0xd3, 0x4e, 0x10, 0xcd, 0xe6, 0x8f, 0x7f, 0xcd, 0x24, 0xed, 0x2f, 0x6c, 0x43, 0x15, 0xb9, 0xad, 0x13, 0xc2, 0x25, 0xaa, 0x84, 0x53, 0xc2, 0x0d, 0x0e, 0xc8, 0x49, 0x4b, 0x55, 0xa4, 0x52, 0xc9, 0x8d, 0x54, 0x71, 0x42, 0x4e, 0xb2, 0x09, 0x96, 0x1a, 0xaf, 0xb1, 0x37, 0x55, 0xe1, 0xc4, 0x05, 0x09, 0xf5, diff --git a/api/services/execution/execution.pb.go b/api/services/execution/execution.pb.go index a8801c4..1de463a 100644 --- a/api/services/execution/execution.pb.go +++ b/api/services/execution/execution.pb.go @@ -17,6 +17,7 @@ InfoRequest ListRequest ListResponse + KillRequest EventsRequest */ package execution @@ -123,12 +124,22 @@ func (m *ListResponse) Reset() { *m = ListResponse{} } func (*ListResponse) ProtoMessage() {} func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{7} } +type KillRequest struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Signal uint32 `protobuf:"varint,2,opt,name=signal,proto3" json:"signal,omitempty"` + All bool `protobuf:"varint,3,opt,name=all,proto3" json:"all,omitempty"` +} + +func (m *KillRequest) Reset() { *m = KillRequest{} } +func (*KillRequest) ProtoMessage() {} +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} } + type EventsRequest struct { } func (m *EventsRequest) Reset() { *m = EventsRequest{} } func (*EventsRequest) ProtoMessage() {} -func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} } +func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{9} } func init() { proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.CreateRequest") @@ -139,6 +150,7 @@ func init() { proto.RegisterType((*InfoRequest)(nil), "containerd.v1.services.InfoRequest") proto.RegisterType((*ListRequest)(nil), "containerd.v1.services.ListRequest") proto.RegisterType((*ListResponse)(nil), "containerd.v1.services.ListResponse") + proto.RegisterType((*KillRequest)(nil), "containerd.v1.services.KillRequest") proto.RegisterType((*EventsRequest)(nil), "containerd.v1.services.EventsRequest") } @@ -158,6 +170,7 @@ type ContainerServiceClient interface { Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, 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) + 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) } @@ -214,6 +227,15 @@ func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts return out, nil } +func (c *containerServiceClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + out := new(google_protobuf.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Kill", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *containerServiceClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, error) { stream, err := grpc.NewClientStream(ctx, &_ContainerService_serviceDesc.Streams[0], c.cc, "/containerd.v1.services.ContainerService/Events", opts...) if err != nil { @@ -254,6 +276,7 @@ type ContainerServiceServer interface { Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) Info(context.Context, *InfoRequest) (*containerd_v1_types1.Container, error) List(context.Context, *ListRequest) (*ListResponse, error) + Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) Events(*EventsRequest, ContainerService_EventsServer) error } @@ -351,6 +374,24 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _ContainerService_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 { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Kill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.ContainerService/Kill", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Kill(ctx, req.(*KillRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _ContainerService_Events_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(EventsRequest) if err := stream.RecvMsg(m); err != nil { @@ -396,6 +437,10 @@ var _ContainerService_serviceDesc = grpc.ServiceDesc{ MethodName: "List", Handler: _ContainerService_List_Handler, }, + { + MethodName: "Kill", + Handler: _ContainerService_Kill_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -665,6 +710,45 @@ func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *KillRequest) 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 *KillRequest) 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.Signal != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintExecution(dAtA, i, uint64(m.Signal)) + } + if m.All { + dAtA[i] = 0x18 + i++ + if m.All { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + func (m *EventsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -823,6 +907,22 @@ func (m *ListResponse) Size() (n int) { return n } +func (m *KillRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.Signal != 0 { + n += 1 + sovExecution(uint64(m.Signal)) + } + if m.All { + n += 2 + } + return n +} + func (m *EventsRequest) Size() (n int) { var l int _ = l @@ -930,6 +1030,18 @@ func (this *ListResponse) String() string { }, "") return s } +func (this *KillRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&KillRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Signal:` + fmt.Sprintf("%v", this.Signal) + `,`, + `All:` + fmt.Sprintf("%v", this.All) + `,`, + `}`, + }, "") + return s +} func (this *EventsRequest) String() string { if this == nil { return "nil" @@ -1790,6 +1902,124 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *KillRequest) 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: KillRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KillRequest: 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 Signal", wireType) + } + m.Signal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Signal |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.All = bool(v != 0) + 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 *EventsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1950,42 +2180,45 @@ func init() { } var fileDescriptorExecution = []byte{ - // 586 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xad, 0x93, 0xd4, 0x0d, 0x93, 0xa6, 0x54, 0xab, 0x28, 0x32, 0x46, 0x72, 0x23, 0xd3, 0x96, - 0x9c, 0x6c, 0x08, 0x37, 0x84, 0x90, 0x68, 0x13, 0xa1, 0x08, 0x8a, 0x84, 0x73, 0xe0, 0x88, 0x9c, - 0x78, 0x13, 0x56, 0x4a, 0x76, 0xcd, 0xee, 0x3a, 0x6a, 0x6e, 0xf0, 0xef, 0x7a, 0xe4, 0xc8, 0x09, - 0xd1, 0xfc, 0x0c, 0x4e, 0xc8, 0x6b, 0x3b, 0x1f, 0x25, 0xc6, 0x70, 0xb1, 0x66, 0x9e, 0xdf, 0x78, - 0xdf, 0xbc, 0xe7, 0x85, 0xd7, 0x13, 0x22, 0x3f, 0x45, 0x43, 0x67, 0xc4, 0x66, 0xee, 0x88, 0x51, - 0xe9, 0x13, 0x8a, 0x79, 0xb0, 0x59, 0xfa, 0x21, 0x71, 0x05, 0xe6, 0x73, 0x32, 0xc2, 0xc2, 0xc5, - 0xd7, 0x78, 0x14, 0x49, 0xc2, 0xe8, 0xba, 0x72, 0x42, 0xce, 0x24, 0x43, 0xcd, 0xf5, 0x88, 0x33, - 0x7f, 0xea, 0x64, 0x13, 0xe6, 0xc3, 0x09, 0x63, 0x93, 0x29, 0x76, 0x15, 0x6b, 0x18, 0x8d, 0x5d, - 0x3c, 0x0b, 0xe5, 0x22, 0x19, 0x32, 0x1f, 0xdc, 0x7d, 0xe9, 0xd3, 0xec, 0x55, 0x63, 0xc2, 0x26, - 0x4c, 0x95, 0x6e, 0x5c, 0xa5, 0xe8, 0x8b, 0x7f, 0x92, 0x2b, 0x17, 0x21, 0x16, 0xee, 0x8c, 0x45, - 0x54, 0x26, 0xcf, 0x74, 0xba, 0xfb, 0x1f, 0xd3, 0x2b, 0x70, 0x5d, 0x25, 0x5f, 0xb1, 0xbf, 0x96, - 0xa0, 0x7e, 0xc9, 0xb1, 0x2f, 0xb1, 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6d, 0x69, 0x69, 0x3f, 0x97, 0x96, 0x36, 0xd4, 0x95, 0xe3, 0xcf, 0x7e, 0x07, 0x00, 0x00, - 0xff, 0xff, 0x8d, 0x48, 0xca, 0x8b, 0xc5, 0x05, 0x00, 0x00, + // 629 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xad, 0x93, 0xd4, 0x2d, 0x93, 0xa6, 0x54, 0xab, 0x2a, 0x5a, 0x8c, 0xe4, 0x46, 0xa6, 0x2d, + 0x39, 0xd9, 0x10, 0x6e, 0x08, 0x21, 0xd1, 0x0f, 0xa1, 0xaa, 0x14, 0x84, 0x7b, 0xe0, 0x88, 0xdc, + 0x64, 0x1b, 0x56, 0x72, 0x76, 0xcd, 0xee, 0xba, 0x6a, 0x6f, 0xf0, 0xcb, 0xb8, 0xf6, 0xc8, 0x91, + 0x13, 0xa2, 0xf9, 0x25, 0x68, 0xd7, 0x76, 0xea, 0x94, 0x18, 0xc3, 0xc5, 0x9a, 0x19, 0xcf, 0xec, + 0xcc, 0xbc, 0xf7, 0x76, 0xe1, 0xf5, 0x98, 0xaa, 0x4f, 0xe9, 0x99, 0x3f, 0xe4, 0x93, 0x60, 0xc8, + 0x99, 0x8a, 0x28, 0x23, 0x62, 0x54, 0x36, 0xa3, 0x84, 0x06, 0x92, 0x88, 0x0b, 0x3a, 0x24, 0x32, + 0x20, 0x97, 0x64, 0x98, 0x2a, 0xca, 0xd9, 0xad, 0xe5, 0x27, 0x82, 0x2b, 0x8e, 0xba, 0xb7, 0x25, + 0xfe, 0xc5, 0x53, 0xbf, 0xa8, 0x70, 0x1e, 0x8e, 0x39, 0x1f, 0xc7, 0x24, 0x30, 0x59, 0x67, 0xe9, + 0x79, 0x40, 0x26, 0x89, 0xba, 0xca, 0x8a, 0x9c, 0x07, 0x77, 0x7f, 0x46, 0xac, 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c6, 0x73, 0xf5, 0x7c, 0x73, 0x82, 0xa9, 0x9e, + 0xef, 0x8e, 0x5c, 0x8e, 0xa1, 0xa5, 0x59, 0x47, 0x8f, 0xaa, 0xf2, 0x4b, 0x9a, 0x70, 0x6a, 0x88, + 0x44, 0xef, 0xa1, 0xa5, 0xc5, 0x50, 0x7d, 0x58, 0x49, 0x39, 0xce, 0xf6, 0xdf, 0x93, 0xf2, 0xf9, + 0xf6, 0xa1, 0xa5, 0xf5, 0x50, 0x7d, 0x64, 0x49, 0x2d, 0x95, 0xe8, 0x9d, 0x80, 0x9d, 0x69, 0xa0, + 0x1a, 0xbd, 0x39, 0x8d, 0x38, 0x8b, 0xdf, 0x20, 0x93, 0xf3, 0xc4, 0xda, 0xc3, 0xd7, 0x37, 0xee, + 0xd2, 0x8f, 0x1b, 0x77, 0xe9, 0xcb, 0xd4, 0xb5, 0xae, 0xa7, 0xae, 0xf5, 0x7d, 0xea, 0x5a, 0xbf, + 0xa6, 0xae, 0x75, 0x66, 0x9b, 0xc6, 0xcf, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xd5, 0xe9, 0x01, + 0xd2, 0x5b, 0x06, 0x00, 0x00, } diff --git a/api/services/execution/execution.proto b/api/services/execution/execution.proto index 1548696..20b0856 100644 --- a/api/services/execution/execution.proto +++ b/api/services/execution/execution.proto @@ -14,6 +14,7 @@ service ContainerService { rpc Delete(DeleteRequest) returns (DeleteResponse); rpc Info(InfoRequest) returns (containerd.v1.types.Container); rpc List(ListRequest) returns (ListResponse); + rpc Kill(KillRequest) returns (google.protobuf.Empty); rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); } @@ -57,5 +58,11 @@ message ListResponse { repeated containerd.v1.types.Container containers = 1; } +message KillRequest { + string id = 1 [(gogoproto.customname) = "ID"]; + uint32 signal = 2; + bool all = 3; +} + message EventsRequest { } diff --git a/api/services/images/images.pb.go b/api/services/images/images.pb.go index 5da1df9..40680b0 100644 --- a/api/services/images/images.pb.go +++ b/api/services/images/images.pb.go @@ -125,9 +125,14 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Images service type ImagesClient interface { + // Get returns an image by name. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // Put assigns the name to a given target image based on the provided + // image. Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + // List returns a list of all images known to containerd. List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + // Delete deletes the image by name. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } @@ -178,9 +183,14 @@ func (c *imagesClient) Delete(ctx context.Context, in *DeleteRequest, opts ...gr // Server API for Images service type ImagesServer interface { + // Get returns an image by name. Get(context.Context, *GetRequest) (*GetResponse, error) + // Put assigns the name to a given target image based on the provided + // image. Put(context.Context, *PutRequest) (*google_protobuf1.Empty, error) + // List returns a list of all images known to containerd. List(context.Context, *ListRequest) (*ListResponse, error) + // Delete deletes the image by name. Delete(context.Context, *DeleteRequest) (*google_protobuf1.Empty, error) } @@ -1325,7 +1335,7 @@ func init() { var fileDescriptorImages = []byte{ // 419 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4d, 0x6f, 0xd3, 0x40, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x52, 0x4d, 0x6f, 0xd3, 0x40, 0x10, 0xcd, 0x36, 0xa9, 0x25, 0xc6, 0xe4, 0xb2, 0xaa, 0x90, 0x71, 0x91, 0x6b, 0x99, 0x4b, 0xc5, 0x61, 0x0d, 0xe6, 0x02, 0x52, 0x29, 0x22, 0x2a, 0x54, 0x48, 0x1c, 0x2a, 0x1f, 0xb9, 0x39, 0xee, 0x60, 0x2c, 0xd5, 0x5e, 0xe3, 0x5d, 0x57, 0xca, 0x0d, 0xfe, 0x5d, 0x8e, 0x1c, 0x39, 0x21, 0xe2, diff --git a/api/services/rootfs/rootfs.pb.go b/api/services/rootfs/rootfs.pb.go index b012d69..1335eee 100644 --- a/api/services/rootfs/rootfs.pb.go +++ b/api/services/rootfs/rootfs.pb.go @@ -1103,7 +1103,7 @@ func init() { var fileDescriptorRootfs = []byte{ // 428 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x4d, 0xab, 0xd3, 0x40, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x52, 0x4d, 0xab, 0xd3, 0x40, 0x14, 0xed, 0xf8, 0x24, 0xad, 0x23, 0x7d, 0x8b, 0xc1, 0x45, 0x08, 0x9a, 0x94, 0xb8, 0x29, 0x82, 0x09, 0xd6, 0x85, 0x1b, 0x5d, 0xf8, 0x5e, 0x2c, 0xbe, 0x85, 0x20, 0x11, 0xd1, 0x9d, 0x4c, 0x93, 0x31, 0x1d, 0x6c, 0xe7, 0x8e, 0x33, 0xd3, 0x42, 0x77, 0xfe, 0x0e, 0x7f, 0x51, 0x97, 0x2e, 0x45, diff --git a/api/services/shim/shim.pb.go b/api/services/shim/shim.pb.go index a128793..c1831d5 100644 --- a/api/services/shim/shim.pb.go +++ b/api/services/shim/shim.pb.go @@ -24,6 +24,7 @@ PauseRequest ResumeRequest ExitRequest + KillRequest */ package shim @@ -191,6 +192,15 @@ func (m *ExitRequest) Reset() { *m = ExitRequest{} } func (*ExitRequest) ProtoMessage() {} func (*ExitRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} } +type KillRequest struct { + Signal uint32 `protobuf:"varint,1,opt,name=signal,proto3" json:"signal,omitempty"` + All bool `protobuf:"varint,2,opt,name=all,proto3" json:"all,omitempty"` +} + +func (m *KillRequest) Reset() { *m = KillRequest{} } +func (*KillRequest) ProtoMessage() {} +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} } + func init() { proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.shim.CreateRequest") proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.shim.CreateResponse") @@ -207,6 +217,7 @@ func init() { proto.RegisterType((*PauseRequest)(nil), "containerd.v1.services.shim.PauseRequest") 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") } // Reference imports to suppress errors if they are not otherwise used. @@ -230,6 +241,7 @@ type ShimClient interface { Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Exit(ctx context.Context, in *ExitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } type shimClient struct { @@ -353,6 +365,15 @@ func (c *shimClient) Exit(ctx context.Context, in *ExitRequest, opts ...grpc.Cal return out, 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...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for Shim service type ShimServer interface { @@ -366,6 +387,7 @@ type ShimServer interface { Pause(context.Context, *PauseRequest) (*google_protobuf1.Empty, error) Resume(context.Context, *ResumeRequest) (*google_protobuf1.Empty, error) Exit(context.Context, *ExitRequest) (*google_protobuf1.Empty, error) + Kill(context.Context, *KillRequest) (*google_protobuf1.Empty, error) } func RegisterShimServer(s *grpc.Server, srv ShimServer) { @@ -555,6 +577,24 @@ func _Shim_Exit_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +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 { + return nil, err + } + if interceptor == nil { + return srv.(ShimServer).Kill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.shim.Shim/Kill", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShimServer).Kill(ctx, req.(*KillRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Shim_serviceDesc = grpc.ServiceDesc{ ServiceName: "containerd.v1.services.shim.Shim", HandlerType: (*ShimServer)(nil), @@ -595,6 +635,10 @@ var _Shim_serviceDesc = grpc.ServiceDesc{ MethodName: "Exit", Handler: _Shim_Exit_Handler, }, + { + MethodName: "Kill", + Handler: _Shim_Kill_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -1067,6 +1111,39 @@ func (m *ExitRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *KillRequest) 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 *KillRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Signal != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.Signal)) + } + if m.All { + dAtA[i] = 0x10 + i++ + if m.All { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + func encodeFixed64Shim(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -1290,6 +1367,18 @@ func (m *ExitRequest) Size() (n int) { return n } +func (m *KillRequest) Size() (n int) { + var l int + _ = l + if m.Signal != 0 { + n += 1 + sovShim(uint64(m.Signal)) + } + if m.All { + n += 2 + } + return n +} + func sovShim(x uint64) (n int) { for { n++ @@ -1467,6 +1556,17 @@ func (this *ExitRequest) String() string { }, "") return s } +func (this *KillRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&KillRequest{`, + `Signal:` + fmt.Sprintf("%v", this.Signal) + `,`, + `All:` + fmt.Sprintf("%v", this.All) + `,`, + `}`, + }, "") + return s +} func valueToStringShim(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -2937,6 +3037,95 @@ func (m *ExitRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *KillRequest) 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: KillRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KillRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Signal", wireType) + } + m.Signal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Signal |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.All = bool(v != 0) + 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 @@ -3047,55 +3236,58 @@ func init() { } var fileDescriptorShim = []byte{ - // 800 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0xaf, 0x13, 0xaf, 0x37, 0xfb, 0x52, 0xa7, 0x68, 0xb4, 0x5a, 0xb9, 0x5e, 0x94, 0x06, 0x5f, - 0x48, 0x8b, 0xe4, 0xd0, 0xf4, 0x86, 0xe0, 0x40, 0xc9, 0x22, 0x40, 0x45, 0x8a, 0x66, 0x8f, 0x48, - 0x54, 0x4e, 0x3c, 0x9b, 0x8c, 0x14, 0x7b, 0x8c, 0x67, 0x1c, 0x9a, 0x1b, 0x67, 0xbe, 0x01, 0x5f, - 0x87, 0x53, 0x8f, 0x5c, 0x90, 0x38, 0x21, 0x9a, 0x4f, 0x82, 0xe6, 0x8f, 0xe3, 0xa4, 0x4d, 0xe2, - 0xec, 0xc5, 0x7a, 0xef, 0xcd, 0xef, 0x8d, 0xdf, 0xfb, 0xbd, 0xdf, 0x1b, 0xf8, 0x6a, 0x46, 0xc5, - 0xbc, 0x98, 0x84, 0x53, 0x96, 0x0c, 0xa6, 0x2c, 0x15, 0x11, 0x4d, 0x49, 0x1e, 0x6f, 0x9b, 0x51, - 0x46, 0x07, 0x9c, 0xe4, 0x4b, 0x3a, 0x25, 0x7c, 0xc0, 0xe7, 0x34, 0x51, 0x9f, 0x30, 0xcb, 0x99, - 0x60, 0xe8, 0xba, 0x02, 0x86, 0xcb, 0xe7, 0x61, 0x89, 0x0b, 0x25, 0xc4, 0x7f, 0x3c, 0x63, 0x6c, - 0xb6, 0x20, 0x03, 0x05, 0x9d, 0x14, 0x77, 0x83, 0x28, 0x5d, 0xe9, 0x3c, 0xff, 0xfa, 0xfd, 0x23, - 0x92, 0x64, 0xa2, 0x3c, 0xbc, 0x9c, 0xb1, 0x19, 0x53, 0xe6, 0x40, 0x5a, 0x26, 0xfa, 0xe5, 0x49, - 0x95, 0x8a, 0x55, 0x46, 0xf8, 0x20, 0x61, 0x45, 0x2a, 0xf4, 0xd7, 0x64, 0x8f, 0xee, 0x91, 0xbd, - 0x09, 0x56, 0x96, 0xbe, 0x25, 0xf8, 0xbd, 0x01, 0xee, 0x37, 0x39, 0x89, 0x04, 0xc1, 0xe4, 0x97, - 0x82, 0x70, 0x81, 0xae, 0xa0, 0x41, 0x63, 0xcf, 0xea, 0x59, 0xfd, 0x8b, 0x97, 0xce, 0xfa, 0xdf, - 0x27, 0x8d, 0xef, 0x47, 0xb8, 0x41, 0x63, 0x74, 0x05, 0xce, 0xa4, 0x48, 0xe3, 0x05, 0xf1, 0x1a, - 0xf2, 0x0c, 0x1b, 0x0f, 0x79, 0x70, 0x9e, 0x17, 0xa9, 0xa0, 0x09, 0xf1, 0x9a, 0xea, 0xa0, 0x74, - 0xd1, 0x63, 0x68, 0xa5, 0xec, 0x75, 0x46, 0x97, 0x4c, 0x78, 0x76, 0xcf, 0xea, 0xb7, 0xf0, 0x79, - 0xca, 0xc6, 0xd2, 0x45, 0x3e, 0xb4, 0x04, 0xc9, 0x13, 0x9a, 0x46, 0x0b, 0xef, 0x4c, 0x1d, 0x6d, - 0x7c, 0x74, 0x09, 0x67, 0x5c, 0xc4, 0x34, 0xf5, 0x1c, 0x75, 0x9d, 0x76, 0xe4, 0xef, 0xb9, 0x88, - 0x59, 0x21, 0xbc, 0x73, 0xfd, 0x7b, 0xed, 0x99, 0x38, 0xc9, 0x73, 0xaf, 0xb5, 0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7, 0xd0, 0x1c, 0x8b, 0x15, 0xfa, - 0xf4, 0x68, 0x46, 0xa5, 0xfe, 0x83, 0x3c, 0x60, 0x70, 0xb4, 0xaa, 0x6b, 0x78, 0xd8, 0x91, 0xbe, - 0xbf, 0xff, 0x2d, 0x54, 0x98, 0xcf, 0x2d, 0xf4, 0xb3, 0x9a, 0x93, 0x20, 0xf5, 0x73, 0xaa, 0x98, - 0x7d, 0x76, 0x0a, 0xb4, 0xd2, 0x81, 0xd2, 0x68, 0xcd, 0xfd, 0xdb, 0x3a, 0x3e, 0xd8, 0xff, 0x2b, - 0x70, 0xb4, 0xbe, 0x6b, 0xfa, 0xdf, 0x59, 0x82, 0x83, 0xb7, 0x7d, 0x27, 0x47, 0x4e, 0x45, 0xed, - 0xc8, 0x69, 0x9d, 0x3e, 0x5f, 0x7a, 0x6f, 0xdf, 0x75, 0x1f, 0xfc, 0xf3, 0xae, 0xfb, 0xe0, 0xb7, - 0x75, 0xd7, 0x7a, 0xbb, 0xee, 0x5a, 0x7f, 0xad, 0xbb, 0xd6, 0x7f, 0xeb, 0xae, 0x35, 0x71, 0x14, - 0xf2, 0xc5, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x76, 0x56, 0x67, 0xa7, 0x08, 0x00, 0x00, + // 837 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x0e, 0x25, 0x9a, 0x96, 0x47, 0xa1, 0x53, 0x2c, 0x0c, 0x83, 0xa1, 0x0b, 0xc5, 0xe5, 0xa5, + 0x4a, 0x0a, 0x50, 0x8d, 0x72, 0x28, 0x50, 0xb4, 0x87, 0xa6, 0x76, 0xd1, 0x9f, 0x14, 0x10, 0xd6, + 0xc7, 0x02, 0x0d, 0x68, 0x71, 0x2d, 0x2d, 0x40, 0x72, 0x59, 0xee, 0x52, 0x8d, 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, 0xc8, 0x96, 0x4c, 0x1b, 0x9a, 0x6d, 0xca, 0xf4, 0xdc, 0x7b, 0xfd, 0x66, 0x70, 0xef, + 0x9f, 0x37, 0x83, 0x7b, 0xbf, 0xad, 0x06, 0xd6, 0xeb, 0xd5, 0xc0, 0xfa, 0x7b, 0x35, 0xb0, 0xfe, + 0x5b, 0x0d, 0xac, 0x5b, 0x47, 0x21, 0x9f, 0xfd, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x25, 0x57, + 0xa4, 0x2a, 0x09, 0x00, 0x00, } diff --git a/api/services/shim/shim.proto b/api/services/shim/shim.proto index c072014..1dfad65 100644 --- a/api/services/shim/shim.proto +++ b/api/services/shim/shim.proto @@ -19,6 +19,7 @@ service Shim { rpc Pause(PauseRequest) returns (google.protobuf.Empty); rpc Resume(ResumeRequest) returns (google.protobuf.Empty); rpc Exit(ExitRequest) returns (google.protobuf.Empty); + rpc Kill(KillRequest) returns (google.protobuf.Empty); } message CreateRequest { @@ -95,3 +96,8 @@ message ResumeRequest { message ExitRequest { } + +message KillRequest { + uint32 signal = 1; + bool all = 2; +} diff --git a/api/types/container/container.pb.go b/api/types/container/container.pb.go index 977b19d..74771fd 100644 --- a/api/types/container/container.pb.go +++ b/api/types/container/container.pb.go @@ -1316,7 +1316,7 @@ func init() { var fileDescriptorContainer = []byte{ // 516 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x8b, 0xd3, 0x5c, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x8b, 0xd3, 0x5c, 0x14, 0xed, 0x4b, 0xd2, 0xb4, 0xbd, 0x65, 0xfa, 0x3d, 0xde, 0x27, 0x12, 0x47, 0xc8, 0x84, 0x22, 0x18, 0x04, 0x53, 0xec, 0x6c, 0xdc, 0x76, 0x9a, 0x30, 0x16, 0x31, 0xad, 0xaf, 0x29, 0xce, 0xae, 0x64, 0x9a, 0x10, 0x9f, 0xcc, 0x24, 0x25, 0x79, 0xad, 0xce, 0xce, 0x9f, 0x37, 0x4b, 0x97, 0xae, diff --git a/api/types/descriptor/descriptor.pb.go b/api/types/descriptor/descriptor.pb.go index e379da3..4062abc 100644 --- a/api/types/descriptor/descriptor.pb.go +++ b/api/types/descriptor/descriptor.pb.go @@ -404,7 +404,7 @@ func init() { var fileDescriptorDescriptor = []byte{ // 229 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4b, 0xcf, 0x2c, 0xc9, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x72, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0xa4, 0x16, 0x27, 0x17, 0x65, 0x16, 0x94, 0xe4, 0x17, 0x21, 0x31, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, diff --git a/api/types/mount/mount.pb.go b/api/types/mount/mount.pb.go index 1748f6e..c509ea1 100644 --- a/api/types/mount/mount.pb.go +++ b/api/types/mount/mount.pb.go @@ -473,7 +473,7 @@ func init() { var fileDescriptorMount = []byte{ // 197 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xe6, 0x97, 0xe6, 0x95, 0x40, 0x48, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x61, 0x84, 0x3a, 0xbd, 0x32, diff --git a/cmd/ctr/kill.go b/cmd/ctr/kill.go new file mode 100644 index 0000000..1accd88 --- /dev/null +++ b/cmd/ctr/kill.go @@ -0,0 +1,115 @@ +package main + +import ( + gocontext "context" + "fmt" + "strconv" + "strings" + "syscall" + + "github.com/containerd/containerd/api/services/execution" + "github.com/pkg/errors" + "github.com/urfave/cli" +) + +var signalMap = map[string]syscall.Signal{ + "ABRT": syscall.SIGABRT, + "ALRM": syscall.SIGALRM, + "BUS": syscall.SIGBUS, + "CHLD": syscall.SIGCHLD, + "CLD": syscall.SIGCLD, + "CONT": syscall.SIGCONT, + "FPE": syscall.SIGFPE, + "HUP": syscall.SIGHUP, + "ILL": syscall.SIGILL, + "INT": syscall.SIGINT, + "IO": syscall.SIGIO, + "IOT": syscall.SIGIOT, + "KILL": syscall.SIGKILL, + "PIPE": syscall.SIGPIPE, + "POLL": syscall.SIGPOLL, + "PROF": syscall.SIGPROF, + "PWR": syscall.SIGPWR, + "QUIT": syscall.SIGQUIT, + "SEGV": syscall.SIGSEGV, + "STKFLT": syscall.SIGSTKFLT, + "STOP": syscall.SIGSTOP, + "SYS": syscall.SIGSYS, + "TERM": syscall.SIGTERM, + "TRAP": syscall.SIGTRAP, + "TSTP": syscall.SIGTSTP, + "TTIN": syscall.SIGTTIN, + "TTOU": syscall.SIGTTOU, + "UNUSED": syscall.SIGUNUSED, + "URG": syscall.SIGURG, + "USR1": syscall.SIGUSR1, + "USR2": syscall.SIGUSR2, + "VTALRM": syscall.SIGVTALRM, + "WINCH": syscall.SIGWINCH, + "XCPU": syscall.SIGXCPU, + "XFSZ": syscall.SIGXFSZ, +} + +var killCommand = cli.Command{ + Name: "kill", + Usage: "signal a container", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "id", + Usage: "id of the container", + }, + cli.BoolFlag{ + Name: "all, a", + Usage: "send signal to all processes inside the container", + }, + }, + Action: func(context *cli.Context) error { + id := context.String("id") + if id == "" { + return errors.New("container id must be provided") + } + + sigstr := context.Args().First() + if sigstr == "" { + sigstr = "SIGTERM" + } + + signal, err := parseSignal(sigstr) + if err != nil { + return err + } + + containers, err := getExecutionService(context) + if err != nil { + return err + } + killRequest := &execution.KillRequest{ + ID: id, + Signal: uint32(signal), + All: context.Bool("all"), + } + _, err = containers.Kill(gocontext.Background(), killRequest) + if err != nil { + return err + } + return nil + }, +} + +func parseSignal(rawSignal string) (syscall.Signal, error) { + s, err := strconv.Atoi(rawSignal) + if err == nil { + sig := syscall.Signal(s) + for _, msig := range signalMap { + if sig == msig { + return sig, nil + } + } + return -1, fmt.Errorf("unknown signal %q", rawSignal) + } + signal, ok := signalMap[strings.TrimPrefix(strings.ToUpper(rawSignal), "SIG")] + if !ok { + return -1, fmt.Errorf("unknown signal %q", rawSignal) + } + return signal, nil +} diff --git a/cmd/ctr/main.go b/cmd/ctr/main.go index 8c10a64..89c5912 100644 --- a/cmd/ctr/main.go +++ b/cmd/ctr/main.go @@ -52,6 +52,7 @@ containerd client deleteCommand, listCommand, infoCommand, + killCommand, shimCommand, pprofCommand, } diff --git a/container.go b/container.go index a041567..5cf9371 100644 --- a/container.go +++ b/container.go @@ -14,6 +14,8 @@ type Container interface { Start(context.Context) error // State returns the container's state State(context.Context) (State, error) + // Kill signals a container + Kill(context.Context, uint32, bool) error } type LinuxContainer interface { diff --git a/linux/container.go b/linux/container.go index 7ad5c09..021112c 100644 --- a/linux/container.go +++ b/linux/container.go @@ -70,3 +70,11 @@ func (c *Container) Resume(ctx context.Context) error { _, err := c.shim.Resume(ctx, &shim.ResumeRequest{}) return err } + +func (c *Container) Kill(ctx context.Context, signal uint32, all bool) error { + _, err := c.shim.Kill(ctx, &shim.KillRequest{ + Signal: signal, + All: all, + }) + return err +} diff --git a/linux/shim/client.go b/linux/shim/client.go index 858dccb..4d6c110 100644 --- a/linux/shim/client.go +++ b/linux/shim/client.go @@ -61,6 +61,10 @@ func (c *client) Resume(ctx context.Context, in *shimapi.ResumeRequest, opts ... return c.s.Resume(ctx, in) } +func (c *client) Kill(ctx context.Context, in *shimapi.KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { + return c.s.Kill(ctx, in) +} + func (c *client) Exit(ctx context.Context, in *shimapi.ExitRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { // don't exit the calling process for the client // but make sure we unmount the containers rootfs for this client diff --git a/linux/shim/init.go b/linux/shim/init.go index 5f3c2c4..d103260 100644 --- a/linux/shim/init.go +++ b/linux/shim/init.go @@ -158,6 +158,12 @@ func (p *initProcess) Resume(context context.Context) error { return p.runc.Resume(context, p.id) } +func (p *initProcess) Kill(context context.Context, signal uint32, all bool) error { + return p.runc.Kill(context, p.id, int(signal), &runc.KillOpts{ + All: all, + }) +} + func (p *initProcess) killAll(context context.Context) error { return p.runc.Kill(context, p.id, int(syscall.SIGKILL), &runc.KillOpts{ All: true, diff --git a/linux/shim/service.go b/linux/shim/service.go index ffad811..55bc89c 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -217,3 +217,10 @@ func (s *Service) Exit(ctx context.Context, r *shimapi.ExitRequest) (*google_pro } return empty, nil } + +func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_protobuf.Empty, error) { + if err := s.initProcess.Kill(ctx, r.Signal, r.All); err != nil { + return nil, err + } + return empty, nil +} diff --git a/services/execution/service.go b/services/execution/service.go index aa55979..5666b96 100644 --- a/services/execution/service.go +++ b/services/execution/service.go @@ -185,6 +185,17 @@ func (s *Service) List(ctx context.Context, r *api.ListRequest) (*api.ListRespon return resp, nil } +func (s *Service) Kill(ctx context.Context, r *api.KillRequest) (*google_protobuf.Empty, error) { + c, err := s.getContainer(r.ID) + if err != nil { + return nil, err + } + if err := c.Kill(ctx, r.Signal, r.All); err != nil { + return nil, err + } + return empty, nil +} + func (s *Service) Events(r *api.EventsRequest, server api.ContainerService_EventsServer) error { w := &grpcEventWriter{ server: server, diff --git a/snapshot/storage/proto/record.pb.go b/snapshot/storage/proto/record.pb.go index 6b09269..c54ef6f 100644 --- a/snapshot/storage/proto/record.pb.go +++ b/snapshot/storage/proto/record.pb.go @@ -447,7 +447,7 @@ func init() { var fileDescriptorRecord = []byte{ // 304 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x49, 0xcf, 0x2c, 0xc9, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x72, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x4a, 0x41, 0x66, 0x16, 0xe7, 0x25, 0x16, 0x14, 0x67, 0xe4, 0x97, 0xe8, 0x17, 0x97, 0xe4, 0x17, 0x25, 0xa6, 0xa7, 0xea, 0x17, 0x14, 0xe5, 0x97, 0xe4, 0xeb, 0x17, 0xa5, 0x26, 0xe7, 0x17, 0xa5,