From 63f4c6d28234f50d36e261447fa62c3e33f8e936 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 11 Apr 2024 16:20:34 +0200 Subject: [PATCH] DRA: move ResourceSlice publishing into DRA drivers This is a first step towards making kubelet independent of the resource.k8s.io API versioning because it now doesn't need to copy structs defined by that API from the driver to the API server. The next step is removing the other direction (reading ResourceClaim status and passing the resource handle to drivers). The drivers must get deployed so that they have their own connection to the API server. Securing at least the writes via a validating admission policy should be possible. As before, the kubelet removes all ResourceSlices for its node at startup, then DRA drivers recreate them if (and only if) they start up again. This ensures that there are no orphaned ResourceSlices when a driver gets removed while the kubelet was down. While at it, logging gets cleaned up and updated to use structured, contextual logging as much as possible. gRPC requests and streams now use a shared, per-process request ID and streams also get logged. Kubernetes-commit: 616a01434756c4a818908a73b9256c9caa7d2c48 --- pkg/apis/dra/v1alpha3/api.pb.go | 478 +++----------------------------- pkg/apis/dra/v1alpha3/api.proto | 15 +- 2 files changed, 42 insertions(+), 451 deletions(-) diff --git a/pkg/apis/dra/v1alpha3/api.pb.go b/pkg/apis/dra/v1alpha3/api.pb.go index c0972a5..3a99296 100644 --- a/pkg/apis/dra/v1alpha3/api.pb.go +++ b/pkg/apis/dra/v1alpha3/api.pb.go @@ -342,88 +342,6 @@ func (m *NodeUnprepareResourceResponse) GetError() string { return "" } -type NodeListAndWatchResourcesRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeListAndWatchResourcesRequest) Reset() { *m = NodeListAndWatchResourcesRequest{} } -func (*NodeListAndWatchResourcesRequest) ProtoMessage() {} -func (*NodeListAndWatchResourcesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{6} -} -func (m *NodeListAndWatchResourcesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeListAndWatchResourcesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NodeListAndWatchResourcesRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NodeListAndWatchResourcesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeListAndWatchResourcesRequest.Merge(m, src) -} -func (m *NodeListAndWatchResourcesRequest) XXX_Size() int { - return m.Size() -} -func (m *NodeListAndWatchResourcesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_NodeListAndWatchResourcesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeListAndWatchResourcesRequest proto.InternalMessageInfo - -type NodeListAndWatchResourcesResponse struct { - Resources []*v1alpha2.ResourceModel `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeListAndWatchResourcesResponse) Reset() { *m = NodeListAndWatchResourcesResponse{} } -func (*NodeListAndWatchResourcesResponse) ProtoMessage() {} -func (*NodeListAndWatchResourcesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{7} -} -func (m *NodeListAndWatchResourcesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeListAndWatchResourcesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NodeListAndWatchResourcesResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NodeListAndWatchResourcesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeListAndWatchResourcesResponse.Merge(m, src) -} -func (m *NodeListAndWatchResourcesResponse) XXX_Size() int { - return m.Size() -} -func (m *NodeListAndWatchResourcesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_NodeListAndWatchResourcesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeListAndWatchResourcesResponse proto.InternalMessageInfo - -func (m *NodeListAndWatchResourcesResponse) GetResources() []*v1alpha2.ResourceModel { - if m != nil { - return m.Resources - } - return nil -} - type Claim struct { // The ResourceClaim namespace (ResourceClaim.meta.Namespace). // This field is REQUIRED. @@ -450,7 +368,7 @@ type Claim struct { func (m *Claim) Reset() { *m = Claim{} } func (*Claim) ProtoMessage() {} func (*Claim) Descriptor() ([]byte, []int) { - return fileDescriptor_00212fb1f9d3bf1c, []int{8} + return fileDescriptor_00212fb1f9d3bf1c, []int{6} } func (m *Claim) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -523,55 +441,49 @@ func init() { proto.RegisterType((*NodeUnprepareResourcesResponse)(nil), "v1alpha3.NodeUnprepareResourcesResponse") proto.RegisterMapType((map[string]*NodeUnprepareResourceResponse)(nil), "v1alpha3.NodeUnprepareResourcesResponse.ClaimsEntry") proto.RegisterType((*NodeUnprepareResourceResponse)(nil), "v1alpha3.NodeUnprepareResourceResponse") - proto.RegisterType((*NodeListAndWatchResourcesRequest)(nil), "v1alpha3.NodeListAndWatchResourcesRequest") - proto.RegisterType((*NodeListAndWatchResourcesResponse)(nil), "v1alpha3.NodeListAndWatchResourcesResponse") proto.RegisterType((*Claim)(nil), "v1alpha3.Claim") } func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) } var fileDescriptor_00212fb1f9d3bf1c = []byte{ - // 631 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x6e, 0xd3, 0x4c, - 0x10, 0xcf, 0xb6, 0x4d, 0xf5, 0x65, 0x22, 0xb5, 0x9f, 0x56, 0x15, 0x0a, 0xa6, 0x98, 0x60, 0x51, - 0x12, 0x51, 0xb0, 0xc1, 0x05, 0x54, 0x81, 0x38, 0xd0, 0x16, 0xd4, 0xa2, 0x82, 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e1, 0x47, 0x2a, 0x99, 0xf6, 0x01, 0xea, 0xe7, 0xd4, 0xf8, 0x7f, 0x98, 0xef, 0xb1, - 0xa3, 0x06, 0x6a, 0xa2, 0x76, 0xcd, 0xc9, 0x44, 0xfc, 0x18, 0xaa, 0x87, 0x24, 0x48, 0x59, 0x63, - 0xae, 0x89, 0xda, 0x75, 0x7b, 0x6d, 0x6a, 0x2e, 0x95, 0xca, 0xc9, 0x63, 0x1e, 0xcd, 0x6d, 0x22, - 0x83, 0x96, 0xd2, 0x32, 0x2c, 0xc6, 0x82, 0xba, 0x4b, 0xfd, 0x03, 0xca, 0x0e, 0x7d, 0x97, 0xe5, - 0x15, 0xd5, 0xb6, 0x96, 0x06, 0x3f, 0xaf, 0xc1, 0xf6, 0xce, 0xde, 0x4e, 0xae, 0x75, 0xc0, 0xa5, - 0x7e, 0x21, 0xe3, 0x15, 0xa8, 0x32, 0xce, 0x23, 0x2e, 0x2f, 0x54, 0x73, 0xf2, 0x83, 0xb1, 0x0b, - 0x57, 0xb3, 0x2c, 0x6f, 0xc3, 0xf8, 0x5f, 0xe9, 0xff, 0x81, 0x40, 0x9f, 0x04, 0x55, 0xdc, 0x79, - 0x7f, 0x0c, 0xeb, 0xfe, 0x28, 0x29, 0x93, 0x23, 0x4b, 0x5b, 0xd0, 0x99, 0xd5, 0x82, 0x27, 0xa3, - 0x2d, 0x68, 0xcd, 0xc8, 0x56, 0xd6, 0x84, 0x07, 0x13, 0xe8, 0x19, 0x96, 0x34, 0x64, 0x15, 0x9d, - 0x67, 0xd5, 0x80, 0x66, 0x16, 0xb6, 0xef, 0x8b, 0xe4, 0x69, 0x48, 0xdf, 0x91, 0xc4, 0xed, 0x8e, - 0x13, 0x6b, 0x84, 0x70, 0x7d, 0x8a, 0x4f, 0x01, 0xbf, 0x07, 0x35, 0xb5, 0x40, 0x8a, 0xb4, 0x75, - 0x33, 0xdf, 0x2e, 0x33, 0x5b, 0x54, 0x65, 0x54, 0xa5, 0xd9, 0xa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, - 0xc5, 0xd3, 0xdf, 0x4b, 0x3b, 0x2c, 0x60, 0x89, 0x15, 0xf7, 0xbc, 0xec, 0x1b, 0x10, 0x16, 0xe5, - 0x44, 0x7d, 0x01, 0x1b, 0x9d, 0x45, 0xf9, 0xf2, 0x6f, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xb2, - 0x0b, 0x57, 0x0c, 0x6d, 0x06, 0x00, 0x00, + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xce, 0x36, 0x49, 0x45, 0x26, 0x52, 0x8b, 0x56, 0x15, 0xb2, 0x42, 0x31, 0x91, 0x45, 0x49, + 0x0e, 0x60, 0x0b, 0x07, 0x50, 0x05, 0xe2, 0x92, 0x16, 0x54, 0x10, 0x42, 0xc8, 0x88, 0x0b, 0x97, + 0xb0, 0xb1, 0x07, 0xc7, 0x4a, 0x62, 0x9b, 0x5d, 0x3b, 0x52, 0x6f, 0x3c, 0x02, 0x8f, 0xd5, 0x03, + 0x07, 0xc4, 0x89, 0x53, 0x45, 0xcd, 0x8d, 0xa7, 0x40, 0x5e, 0xdb, 0x69, 0x13, 0x39, 0x4d, 0xa5, + 0xde, 0x66, 0xe7, 0xef, 0x9b, 0xfd, 0xe6, 0x07, 0x1a, 0x2c, 0xf4, 0xf4, 0x90, 0x07, 0x51, 0x40, + 0x6f, 0xcc, 0x1e, 0xb1, 0x49, 0x38, 0x62, 0xbd, 0xd6, 0x43, 0xd7, 0x8b, 0x46, 0xf1, 0x50, 0xb7, + 0x83, 0xa9, 0xe1, 0x06, 0x6e, 0x60, 0x48, 0x87, 0x61, 0xfc, 0x45, 0xbe, 0xe4, 0x43, 0x4a, 0x59, + 0x60, 0xeb, 0xc1, 0x78, 0x5f, 0xe8, 0x5e, 0x60, 0xb0, 0xd0, 0x33, 0x38, 0x8a, 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, 0x95, 0x6f, 0x89, 0x4a, 0x4e, 0x12, 0x95, 0xfc, + 0x4c, 0x54, 0xf2, 0x27, 0x51, 0xc9, 0xf7, 0xbf, 0x6a, 0xe5, 0xd3, 0xbd, 0xfc, 0xd8, 0x8d, 0xe3, + 0x21, 0x4e, 0x30, 0x32, 0xc2, 0xb1, 0x9b, 0x1e, 0x3e, 0x61, 0x38, 0x9c, 0x15, 0x47, 0xaf, 0x37, + 0xdc, 0x94, 0xb7, 0xae, 0xf7, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x14, 0x30, 0xd4, 0x5f, 0x05, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -594,10 +506,6 @@ type NodeClient interface { // NodeUnprepareResources is the opposite of NodePrepareResources. // The same error handling rules apply, NodeUnprepareResources(ctx context.Context, in *NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*NodeUnprepareResourcesResponse, error) - // NodeListAndWatchResources returns a stream of NodeResourcesResponse objects. - // At the start and whenever resource availability changes, the - // plugin must send one such object with all information to the Kubelet. - NodeListAndWatchResources(ctx context.Context, in *NodeListAndWatchResourcesRequest, opts ...grpc.CallOption) (Node_NodeListAndWatchResourcesClient, error) } type nodeClient struct { @@ -626,38 +534,6 @@ func (c *nodeClient) NodeUnprepareResources(ctx context.Context, in *NodeUnprepa return out, nil } -func (c *nodeClient) NodeListAndWatchResources(ctx context.Context, in *NodeListAndWatchResourcesRequest, opts ...grpc.CallOption) (Node_NodeListAndWatchResourcesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Node_serviceDesc.Streams[0], "/v1alpha3.Node/NodeListAndWatchResources", opts...) - if err != nil { - return nil, err - } - x := &nodeNodeListAndWatchResourcesClient{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 Node_NodeListAndWatchResourcesClient interface { - Recv() (*NodeListAndWatchResourcesResponse, error) - grpc.ClientStream -} - -type nodeNodeListAndWatchResourcesClient struct { - grpc.ClientStream -} - -func (x *nodeNodeListAndWatchResourcesClient) Recv() (*NodeListAndWatchResourcesResponse, error) { - m := new(NodeListAndWatchResourcesResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - // NodeServer is the server API for Node service. type NodeServer interface { // NodePrepareResources prepares several ResourceClaims @@ -668,10 +544,6 @@ type NodeServer interface { // NodeUnprepareResources is the opposite of NodePrepareResources. // The same error handling rules apply, NodeUnprepareResources(context.Context, *NodeUnprepareResourcesRequest) (*NodeUnprepareResourcesResponse, error) - // NodeListAndWatchResources returns a stream of NodeResourcesResponse objects. - // At the start and whenever resource availability changes, the - // plugin must send one such object with all information to the Kubelet. - NodeListAndWatchResources(*NodeListAndWatchResourcesRequest, Node_NodeListAndWatchResourcesServer) error } // UnimplementedNodeServer can be embedded to have forward compatible implementations. @@ -684,9 +556,6 @@ func (*UnimplementedNodeServer) NodePrepareResources(ctx context.Context, req *N func (*UnimplementedNodeServer) NodeUnprepareResources(ctx context.Context, req *NodeUnprepareResourcesRequest) (*NodeUnprepareResourcesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NodeUnprepareResources not implemented") } -func (*UnimplementedNodeServer) NodeListAndWatchResources(req *NodeListAndWatchResourcesRequest, srv Node_NodeListAndWatchResourcesServer) error { - return status.Errorf(codes.Unimplemented, "method NodeListAndWatchResources not implemented") -} func RegisterNodeServer(s *grpc.Server, srv NodeServer) { s.RegisterService(&_Node_serviceDesc, srv) @@ -728,27 +597,6 @@ func _Node_NodeUnprepareResources_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } -func _Node_NodeListAndWatchResources_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(NodeListAndWatchResourcesRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(NodeServer).NodeListAndWatchResources(m, &nodeNodeListAndWatchResourcesServer{stream}) -} - -type Node_NodeListAndWatchResourcesServer interface { - Send(*NodeListAndWatchResourcesResponse) error - grpc.ServerStream -} - -type nodeNodeListAndWatchResourcesServer struct { - grpc.ServerStream -} - -func (x *nodeNodeListAndWatchResourcesServer) Send(m *NodeListAndWatchResourcesResponse) error { - return x.ServerStream.SendMsg(m) -} - var _Node_serviceDesc = grpc.ServiceDesc{ ServiceName: "v1alpha3.Node", HandlerType: (*NodeServer)(nil), @@ -762,13 +610,7 @@ var _Node_serviceDesc = grpc.ServiceDesc{ Handler: _Node_NodeUnprepareResources_Handler, }, }, - Streams: []grpc.StreamDesc{ - { - StreamName: "NodeListAndWatchResources", - Handler: _Node_NodeListAndWatchResources_Handler, - ServerStreams: true, - }, - }, + Streams: []grpc.StreamDesc{}, Metadata: "api.proto", } @@ -1013,66 +855,6 @@ func (m *NodeUnprepareResourceResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *NodeListAndWatchResourcesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeListAndWatchResourcesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeListAndWatchResourcesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *NodeListAndWatchResourcesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeListAndWatchResourcesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeListAndWatchResourcesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Resources) > 0 { - for iNdEx := len(m.Resources) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Resources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintApi(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *Claim) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1255,30 +1037,6 @@ func (m *NodeUnprepareResourceResponse) Size() (n int) { return n } -func (m *NodeListAndWatchResourcesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *NodeListAndWatchResourcesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Resources) > 0 { - for _, e := range m.Resources { - l = e.Size() - n += 1 + l + sovApi(uint64(l)) - } - } - return n -} - func (m *Claim) Size() (n int) { if m == nil { return 0 @@ -1407,30 +1165,6 @@ func (this *NodeUnprepareResourceResponse) String() string { }, "") return s } -func (this *NodeListAndWatchResourcesRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeListAndWatchResourcesRequest{`, - `}`, - }, "") - return s -} -func (this *NodeListAndWatchResourcesResponse) String() string { - if this == nil { - return "nil" - } - repeatedStringForResources := "[]*ResourceModel{" - for _, f := range this.Resources { - repeatedStringForResources += strings.Replace(fmt.Sprintf("%v", f), "ResourceModel", "v1alpha2.ResourceModel", 1) + "," - } - repeatedStringForResources += "}" - s := strings.Join([]string{`&NodeListAndWatchResourcesResponse{`, - `Resources:` + repeatedStringForResources + `,`, - `}`, - }, "") - return s -} func (this *Claim) String() string { if this == nil { return "nil" @@ -2180,140 +1914,6 @@ func (m *NodeUnprepareResourceResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeListAndWatchResourcesRequest) 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 ErrIntOverflowApi - } - 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: NodeListAndWatchResourcesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeListAndWatchResourcesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeListAndWatchResourcesResponse) 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 ErrIntOverflowApi - } - 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: NodeListAndWatchResourcesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeListAndWatchResourcesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthApi - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Resources = append(m.Resources, &v1alpha2.ResourceModel{}) - if err := m.Resources[len(m.Resources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Claim) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/pkg/apis/dra/v1alpha3/api.proto b/pkg/apis/dra/v1alpha3/api.proto index 3e83ba8..a4879e6 100644 --- a/pkg/apis/dra/v1alpha3/api.proto +++ b/pkg/apis/dra/v1alpha3/api.proto @@ -45,11 +45,9 @@ service Node { rpc NodeUnprepareResources (NodeUnprepareResourcesRequest) returns (NodeUnprepareResourcesResponse) {} - // NodeListAndWatchResources returns a stream of NodeResourcesResponse objects. - // At the start and whenever resource availability changes, the - // plugin must send one such object with all information to the Kubelet. - rpc NodeListAndWatchResources(NodeListAndWatchResourcesRequest) - returns (stream NodeListAndWatchResourcesResponse) {} + // TODO: removing NodeListAndWatchResources and the code for + // publishing ResourceSlice objects by kubelet is an API break. + // If we do this, then v1alpha3 must be renamed to v1alpha4. } message NodePrepareResourcesRequest { @@ -94,13 +92,6 @@ message NodeUnprepareResourceResponse { string error = 1; } -message NodeListAndWatchResourcesRequest { -} - -message NodeListAndWatchResourcesResponse { - repeated k8s.io.api.resource.v1alpha2.ResourceModel resources = 1; -} - message Claim { // The ResourceClaim namespace (ResourceClaim.meta.Namespace). // This field is REQUIRED.