diff --git a/pkg/kubelet/cm/dra/manager.go b/pkg/kubelet/cm/dra/manager.go index e9bebbc0423..a5bac2ff041 100644 --- a/pkg/kubelet/cm/dra/manager.go +++ b/pkg/kubelet/cm/dra/manager.go @@ -32,7 +32,7 @@ import ( "k8s.io/component-base/metrics" "k8s.io/dynamic-resource-allocation/resourceclaim" "k8s.io/klog/v2" - drapb "k8s.io/kubelet/pkg/apis/dra/v1beta1" + drapb "k8s.io/kubelet/pkg/apis/dra/v1" draplugin "k8s.io/kubernetes/pkg/kubelet/cm/dra/plugin" "k8s.io/kubernetes/pkg/kubelet/cm/dra/state" "k8s.io/kubernetes/pkg/kubelet/config" diff --git a/pkg/kubelet/cm/dra/plugin/dra_plugin.go b/pkg/kubelet/cm/dra/plugin/dra_plugin.go index 603e7dcda25..b1f4a1f659f 100644 --- a/pkg/kubelet/cm/dra/plugin/dra_plugin.go +++ b/pkg/kubelet/cm/dra/plugin/dra_plugin.go @@ -25,6 +25,7 @@ import ( "google.golang.org/grpc/status" "k8s.io/klog/v2" + drapbv1 "k8s.io/kubelet/pkg/apis/dra/v1" drapbv1beta1 "k8s.io/kubelet/pkg/apis/dra/v1beta1" "k8s.io/kubernetes/pkg/kubelet/metrics" ) @@ -41,6 +42,7 @@ const defaultClientCallTimeout = 45 * time.Second // All API versions supported by this wrapper. // Sorted by most recent first, oldest last. var servicesSupportedByKubelet = []string{ + drapbv1.DRAPluginService, drapbv1beta1.DRAPluginService, } @@ -51,7 +53,7 @@ type DRAPlugin struct { driverName string conn *grpc.ClientConn endpoint string - chosenService string // e.g. drapbv1beta1.DRAPluginService + chosenService string // e.g. drapbv1.DRAPluginService clientCallTimeout time.Duration } @@ -61,9 +63,9 @@ func (p *DRAPlugin) DriverName() string { func (p *DRAPlugin) NodePrepareResources( ctx context.Context, - req *drapbv1beta1.NodePrepareResourcesRequest, + req *drapbv1.NodePrepareResourcesRequest, opts ...grpc.CallOption, -) (*drapbv1beta1.NodePrepareResourcesResponse, error) { +) (*drapbv1.NodePrepareResourcesResponse, error) { logger := klog.FromContext(ctx) logger = klog.LoggerWithValues(logger, "driverName", p.driverName, "endpoint", p.endpoint) ctx = klog.NewContext(ctx, logger) @@ -73,11 +75,14 @@ func (p *DRAPlugin) NodePrepareResources( defer cancel() var err error - var response *drapbv1beta1.NodePrepareResourcesResponse + var response *drapbv1.NodePrepareResourcesResponse switch p.chosenService { case drapbv1beta1.DRAPluginService: - nodeClient := drapbv1beta1.NewDRAPluginClient(p.conn) - response, err = nodeClient.NodePrepareResources(ctx, req) + client := drapbv1beta1.NewDRAPluginClient(p.conn) + response, err = drapbv1beta1.V1Beta1ClientWrapper{DRAPluginClient: client}.NodePrepareResources(ctx, req) + case drapbv1.DRAPluginService: + client := drapbv1.NewDRAPluginClient(p.conn) + response, err = client.NodePrepareResources(ctx, req) default: // Shouldn't happen, validateSupportedServices should only // return services we support here. @@ -89,9 +94,9 @@ func (p *DRAPlugin) NodePrepareResources( func (p *DRAPlugin) NodeUnprepareResources( ctx context.Context, - req *drapbv1beta1.NodeUnprepareResourcesRequest, + req *drapbv1.NodeUnprepareResourcesRequest, opts ...grpc.CallOption, -) (*drapbv1beta1.NodeUnprepareResourcesResponse, error) { +) (*drapbv1.NodeUnprepareResourcesResponse, error) { logger := klog.FromContext(ctx) logger.V(4).Info("Calling NodeUnprepareResource rpc", "request", req) logger = klog.LoggerWithValues(logger, "driverName", p.driverName, "endpoint", p.endpoint) @@ -101,11 +106,14 @@ func (p *DRAPlugin) NodeUnprepareResources( defer cancel() var err error - var response *drapbv1beta1.NodeUnprepareResourcesResponse + var response *drapbv1.NodeUnprepareResourcesResponse switch p.chosenService { case drapbv1beta1.DRAPluginService: - nodeClient := drapbv1beta1.NewDRAPluginClient(p.conn) - response, err = nodeClient.NodeUnprepareResources(ctx, req) + client := drapbv1beta1.NewDRAPluginClient(p.conn) + response, err = drapbv1beta1.V1Beta1ClientWrapper{DRAPluginClient: client}.NodeUnprepareResources(ctx, req) + case drapbv1.DRAPluginService: + client := drapbv1.NewDRAPluginClient(p.conn) + response, err = client.NodeUnprepareResources(ctx, req) default: // Shouldn't happen, validateSupportedServices should only // return services we support here. diff --git a/pkg/kubelet/cm/dra/plugin/dra_plugin_test.go b/pkg/kubelet/cm/dra/plugin/dra_plugin_test.go index e948fcf7024..a4b65c58a74 100644 --- a/pkg/kubelet/cm/dra/plugin/dra_plugin_test.go +++ b/pkg/kubelet/cm/dra/plugin/dra_plugin_test.go @@ -29,6 +29,7 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/grpc" + drapbv1 "k8s.io/kubelet/pkg/apis/dra/v1" drapbv1beta1 "k8s.io/kubelet/pkg/apis/dra/v1beta1" "k8s.io/kubernetes/test/utils/ktesting" ) @@ -36,11 +37,11 @@ import ( type fakeGRPCServer struct { } -var _ drapbv1beta1.DRAPluginServer = &fakeGRPCServer{} +var _ drapbv1.DRAPluginServer = &fakeGRPCServer{} -func (f *fakeGRPCServer) NodePrepareResources(ctx context.Context, in *drapbv1beta1.NodePrepareResourcesRequest) (*drapbv1beta1.NodePrepareResourcesResponse, error) { - return &drapbv1beta1.NodePrepareResourcesResponse{Claims: map[string]*drapbv1beta1.NodePrepareResourceResponse{"claim-uid": { - Devices: []*drapbv1beta1.Device{ +func (f *fakeGRPCServer) NodePrepareResources(ctx context.Context, in *drapbv1.NodePrepareResourcesRequest) (*drapbv1.NodePrepareResourcesResponse, error) { + return &drapbv1.NodePrepareResourcesResponse{Claims: map[string]*drapbv1.NodePrepareResourceResponse{"claim-uid": { + Devices: []*drapbv1.Device{ { RequestNames: []string{"test-request"}, CDIDeviceIDs: []string{"test-cdi-id"}, @@ -49,9 +50,9 @@ func (f *fakeGRPCServer) NodePrepareResources(ctx context.Context, in *drapbv1be }}}, nil } -func (f *fakeGRPCServer) NodeUnprepareResources(ctx context.Context, in *drapbv1beta1.NodeUnprepareResourcesRequest) (*drapbv1beta1.NodeUnprepareResourcesResponse, error) { +func (f *fakeGRPCServer) NodeUnprepareResources(ctx context.Context, in *drapbv1.NodeUnprepareResourcesRequest) (*drapbv1.NodeUnprepareResourcesResponse, error) { - return &drapbv1beta1.NodeUnprepareResourcesResponse{}, nil + return &drapbv1.NodeUnprepareResourcesResponse{}, nil } // tearDown is an idempotent cleanup function. @@ -72,8 +73,10 @@ func setupFakeGRPCServer(service, addr string) (tearDown, error) { s := grpc.NewServer() fakeGRPCServer := &fakeGRPCServer{} switch service { + case drapbv1.DRAPluginService: + drapbv1.RegisterDRAPluginServer(s, fakeGRPCServer) case drapbv1beta1.DRAPluginService: - drapbv1beta1.RegisterDRAPluginServer(s, fakeGRPCServer) + drapbv1beta1.RegisterDRAPluginServer(s, drapbv1beta1.V1ServerWrapper{DRAPluginServer: fakeGRPCServer}) default: return nil, fmt.Errorf("unsupported gRPC service: %s", service) } @@ -93,7 +96,7 @@ func setupFakeGRPCServer(service, addr string) (tearDown, error) { func TestGRPCConnIsReused(t *testing.T) { tCtx := ktesting.Init(t) - service := drapbv1beta1.DRAPluginService + service := drapbv1.DRAPluginService addr := path.Join(t.TempDir(), "dra.sock") teardown, err := setupFakeGRPCServer(service, addr) if err != nil { @@ -125,8 +128,8 @@ func TestGRPCConnIsReused(t *testing.T) { return } - req := &drapbv1beta1.NodePrepareResourcesRequest{ - Claims: []*drapbv1beta1.Claim{ + req := &drapbv1.NodePrepareResourcesRequest{ + Claims: []*drapbv1.Claim{ { Namespace: "dummy-namespace", UID: "dummy-uid", @@ -210,10 +213,22 @@ func TestGRPCMethods(t *testing.T) { service: drapbv1beta1.DRAPluginService, chosenService: drapbv1beta1.DRAPluginService, }, + { + description: "v1", + service: drapbv1.DRAPluginService, + chosenService: drapbv1.DRAPluginService, + }, + { + // In practice, such a mismatch between plugin and kubelet should not happen. + description: "mismatch", + service: drapbv1.DRAPluginService, + chosenService: drapbv1beta1.DRAPluginService, + expectError: "unknown service k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin", + }, { // In practice, kubelet wouldn't choose an invalid service. description: "internal-error", - service: drapbv1beta1.DRAPluginService, + service: drapbv1.DRAPluginService, chosenService: "some-other-service", expectError: "unsupported chosen service", }, @@ -235,10 +250,10 @@ func TestGRPCMethods(t *testing.T) { t.Fatal(err) } - _, err = plugin.NodePrepareResources(tCtx, &drapbv1beta1.NodePrepareResourcesRequest{}) + _, err = plugin.NodePrepareResources(tCtx, &drapbv1.NodePrepareResourcesRequest{}) assertError(t, test.expectError, err) - _, err = plugin.NodeUnprepareResources(tCtx, &drapbv1beta1.NodeUnprepareResourcesRequest{}) + _, err = plugin.NodeUnprepareResources(tCtx, &drapbv1.NodeUnprepareResourcesRequest{}) assertError(t, test.expectError, err) }) } diff --git a/staging/src/k8s.io/dynamic-resource-allocation/kubeletplugin/draplugin.go b/staging/src/k8s.io/dynamic-resource-allocation/kubeletplugin/draplugin.go index 51aa219d299..56842d23680 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/kubeletplugin/draplugin.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/kubeletplugin/draplugin.go @@ -37,7 +37,8 @@ import ( draclient "k8s.io/dynamic-resource-allocation/client" "k8s.io/dynamic-resource-allocation/resourceclaim" "k8s.io/dynamic-resource-allocation/resourceslice" - drapb "k8s.io/kubelet/pkg/apis/dra/v1beta1" + drapbv1 "k8s.io/kubelet/pkg/apis/dra/v1" + drapbv1beta1 "k8s.io/kubelet/pkg/apis/dra/v1beta1" registerapi "k8s.io/kubelet/pkg/apis/pluginregistration/v1" ) @@ -379,6 +380,18 @@ func NodeV1beta1(enabled bool) Option { } } +// NodeV1 explicitly chooses whether the DRA gRPC API v1 +// gets enabled. True by default. +// +// This is used in Kubernetes for end-to-end testing. The default should +// be fine for DRA drivers. +func NodeV1(enabled bool) Option { + return func(o *options) error { + o.nodeV1 = enabled + return nil + } +} + // KubeClient grants the plugin access to the API server. This is needed // for syncing ResourceSlice objects. It's the responsibility of the DRA driver // developer to ensure that this client has permission to read, write, @@ -471,6 +484,7 @@ type options struct { serialize bool flockDirectoryPath string nodeV1beta1 bool + nodeV1 bool registrationService bool draService bool } @@ -520,6 +534,7 @@ func Start(ctx context.Context, plugin DRAPlugin, opts ...Option) (result *Helpe grpcVerbosity: 6, // Logs requests and responses, which can be large. serialize: true, nodeV1beta1: true, + nodeV1: true, pluginRegistrationEndpoint: endpoint{ dir: KubeletRegistryDir, }, @@ -597,9 +612,11 @@ func Start(ctx context.Context, plugin DRAPlugin, opts ...Option) (result *Helpe }() var supportedServices []string + if o.nodeV1 { + supportedServices = append(supportedServices, drapbv1.DRAPluginService) + } if o.nodeV1beta1 { - logger.V(5).Info("registering v1beta1.DRAPlugin gRPC service") - supportedServices = append(supportedServices, drapb.DRAPluginService) + supportedServices = append(supportedServices, drapbv1beta1.DRAPluginService) } if len(supportedServices) == 0 { return nil, errors.New("no supported DRA gRPC API is implemented and enabled") @@ -622,9 +639,13 @@ func Start(ctx context.Context, plugin DRAPlugin, opts ...Option) (result *Helpe plugin.HandleError(ctx, err, "DRA gRPC server failed") }, func(grpcServer *grpc.Server) { + if o.nodeV1 { + logger.V(5).Info("registering v1.DRAPlugin gRPC service") + drapbv1.RegisterDRAPluginServer(grpcServer, &nodePluginImplementation{Helper: d}) + } if o.nodeV1beta1 { logger.V(5).Info("registering v1beta1.DRAPlugin gRPC service") - drapb.RegisterDRAPluginServer(grpcServer, &nodePluginImplementation{Helper: d}) + drapbv1beta1.RegisterDRAPluginServer(grpcServer, drapbv1beta1.V1ServerWrapper{DRAPluginServer: &nodePluginImplementation{Helper: d}}) } }, ) @@ -803,8 +824,8 @@ type nodePluginImplementation struct { *Helper } -// NodePrepareResources implements [drapb.NodePrepareResources]. -func (d *nodePluginImplementation) NodePrepareResources(ctx context.Context, req *drapb.NodePrepareResourcesRequest) (*drapb.NodePrepareResourcesResponse, error) { +// NodePrepareResources implements [drapbv1.NodePrepareResources]. +func (d *nodePluginImplementation) NodePrepareResources(ctx context.Context, req *drapbv1.NodePrepareResourcesRequest) (*drapbv1.NodePrepareResourcesResponse, error) { // Do slow API calls before serializing. claims, err := d.getResourceClaims(ctx, req.Claims) if err != nil { @@ -822,11 +843,11 @@ func (d *nodePluginImplementation) NodePrepareResources(ctx context.Context, req return nil, fmt.Errorf("prepare resource claims: %w", err) } - resp := &drapb.NodePrepareResourcesResponse{Claims: map[string]*drapb.NodePrepareResourceResponse{}} + resp := &drapbv1.NodePrepareResourcesResponse{Claims: map[string]*drapbv1.NodePrepareResourceResponse{}} for uid, claimResult := range result { - var devices []*drapb.Device + var devices []*drapbv1.Device for _, result := range claimResult.Devices { - device := &drapb.Device{ + device := &drapbv1.Device{ RequestNames: stripSubrequestNames(result.Requests), PoolName: result.PoolName, DeviceName: result.DeviceName, @@ -834,7 +855,7 @@ func (d *nodePluginImplementation) NodePrepareResources(ctx context.Context, req } devices = append(devices, device) } - resp.Claims[string(uid)] = &drapb.NodePrepareResourceResponse{ + resp.Claims[string(uid)] = &drapbv1.NodePrepareResourceResponse{ Error: errorString(claimResult.Err), Devices: devices, } @@ -857,7 +878,7 @@ func stripSubrequestNames(names []string) []string { return stripped } -func (d *nodePluginImplementation) getResourceClaims(ctx context.Context, claims []*drapb.Claim) ([]*resourceapi.ResourceClaim, error) { +func (d *nodePluginImplementation) getResourceClaims(ctx context.Context, claims []*drapbv1.Claim) ([]*resourceapi.ResourceClaim, error) { var resourceClaims []*resourceapi.ResourceClaim for _, claimReq := range claims { claim, err := d.resourceClient.ResourceClaims(claimReq.Namespace).Get(ctx, claimReq.Name, metav1.GetOptions{}) @@ -876,7 +897,7 @@ func (d *nodePluginImplementation) getResourceClaims(ctx context.Context, claims } // NodeUnprepareResources implements [draapi.NodeUnprepareResources]. -func (d *nodePluginImplementation) NodeUnprepareResources(ctx context.Context, req *drapb.NodeUnprepareResourcesRequest) (*drapb.NodeUnprepareResourcesResponse, error) { +func (d *nodePluginImplementation) NodeUnprepareResources(ctx context.Context, req *drapbv1.NodeUnprepareResourcesRequest) (*drapbv1.NodeUnprepareResourcesResponse, error) { unlock, err := d.serializeGRPCIfEnabled() if err != nil { return nil, fmt.Errorf("serialize gRPC: %w", err) @@ -892,9 +913,9 @@ func (d *nodePluginImplementation) NodeUnprepareResources(ctx context.Context, r return nil, fmt.Errorf("unprepare resource claims: %w", err) } - resp := &drapb.NodeUnprepareResourcesResponse{Claims: map[string]*drapb.NodeUnprepareResourceResponse{}} + resp := &drapbv1.NodeUnprepareResourcesResponse{Claims: map[string]*drapbv1.NodeUnprepareResourceResponse{}} for uid, err := range result { - resp.Claims[string(uid)] = &drapb.NodeUnprepareResourceResponse{ + resp.Claims[string(uid)] = &drapbv1.NodeUnprepareResourceResponse{ Error: errorString(err), } } diff --git a/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/api.pb.go b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/api.pb.go new file mode 100644 index 00000000000..c36e4b3018e --- /dev/null +++ b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/api.pb.go @@ -0,0 +1,2450 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: api.proto + +package v1 + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type NodePrepareResourcesRequest struct { + // The list of ResourceClaims that are to be prepared. + Claims []*Claim `protobuf:"bytes,1,rep,name=claims,proto3" json:"claims,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodePrepareResourcesRequest) Reset() { *m = NodePrepareResourcesRequest{} } +func (*NodePrepareResourcesRequest) ProtoMessage() {} +func (*NodePrepareResourcesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{0} +} +func (m *NodePrepareResourcesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodePrepareResourcesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodePrepareResourcesRequest.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 *NodePrepareResourcesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodePrepareResourcesRequest.Merge(m, src) +} +func (m *NodePrepareResourcesRequest) XXX_Size() int { + return m.Size() +} +func (m *NodePrepareResourcesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NodePrepareResourcesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NodePrepareResourcesRequest proto.InternalMessageInfo + +func (m *NodePrepareResourcesRequest) GetClaims() []*Claim { + if m != nil { + return m.Claims + } + return nil +} + +type NodePrepareResourcesResponse struct { + // The ResourceClaims for which preparation was done + // or attempted, with claim_uid as key. + // + // It is an error if some claim listed in NodePrepareResourcesRequest + // does not get prepared. NodePrepareResources + // will be called again for those that are missing. + Claims map[string]*NodePrepareResourceResponse `protobuf:"bytes,1,rep,name=claims,proto3" json:"claims,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodePrepareResourcesResponse) Reset() { *m = NodePrepareResourcesResponse{} } +func (*NodePrepareResourcesResponse) ProtoMessage() {} +func (*NodePrepareResourcesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{1} +} +func (m *NodePrepareResourcesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodePrepareResourcesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodePrepareResourcesResponse.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 *NodePrepareResourcesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodePrepareResourcesResponse.Merge(m, src) +} +func (m *NodePrepareResourcesResponse) XXX_Size() int { + return m.Size() +} +func (m *NodePrepareResourcesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NodePrepareResourcesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NodePrepareResourcesResponse proto.InternalMessageInfo + +func (m *NodePrepareResourcesResponse) GetClaims() map[string]*NodePrepareResourceResponse { + if m != nil { + return m.Claims + } + return nil +} + +type NodePrepareResourceResponse struct { + // These are the additional devices that kubelet must + // make available via the container runtime. A claim + // may have zero or more requests and each request + // may have zero or more devices. + Devices []*Device `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty"` + // If non-empty, preparing the ResourceClaim failed. + // Devices are ignored in that case. + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodePrepareResourceResponse) Reset() { *m = NodePrepareResourceResponse{} } +func (*NodePrepareResourceResponse) ProtoMessage() {} +func (*NodePrepareResourceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{2} +} +func (m *NodePrepareResourceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodePrepareResourceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodePrepareResourceResponse.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 *NodePrepareResourceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodePrepareResourceResponse.Merge(m, src) +} +func (m *NodePrepareResourceResponse) XXX_Size() int { + return m.Size() +} +func (m *NodePrepareResourceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NodePrepareResourceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NodePrepareResourceResponse proto.InternalMessageInfo + +func (m *NodePrepareResourceResponse) GetDevices() []*Device { + if m != nil { + return m.Devices + } + return nil +} + +func (m *NodePrepareResourceResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +type Device struct { + // The requests in the claim that this device is associated with. + // Optional. If empty, the device is associated with all requests. + RequestNames []string `protobuf:"bytes,1,rep,name=request_names,json=requestNames,proto3" json:"request_names,omitempty"` + // The pool which contains the device. Required. + PoolName string `protobuf:"bytes,2,opt,name=pool_name,json=poolName,proto3" json:"pool_name,omitempty"` + // The device itself. Required. + DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"` + // A single device instance may map to several CDI device IDs. + // None is also valid. + CDIDeviceIDs []string `protobuf:"bytes,4,rep,name=cdi_device_ids,json=cdiDeviceIds,proto3" json:"cdi_device_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Device) Reset() { *m = Device{} } +func (*Device) ProtoMessage() {} +func (*Device) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{3} +} +func (m *Device) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Device) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Device.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 *Device) XXX_Merge(src proto.Message) { + xxx_messageInfo_Device.Merge(m, src) +} +func (m *Device) XXX_Size() int { + return m.Size() +} +func (m *Device) XXX_DiscardUnknown() { + xxx_messageInfo_Device.DiscardUnknown(m) +} + +var xxx_messageInfo_Device proto.InternalMessageInfo + +func (m *Device) GetRequestNames() []string { + if m != nil { + return m.RequestNames + } + return nil +} + +func (m *Device) GetPoolName() string { + if m != nil { + return m.PoolName + } + return "" +} + +func (m *Device) GetDeviceName() string { + if m != nil { + return m.DeviceName + } + return "" +} + +func (m *Device) GetCDIDeviceIDs() []string { + if m != nil { + return m.CDIDeviceIDs + } + return nil +} + +type NodeUnprepareResourcesRequest struct { + // The list of ResourceClaims that are to be unprepared. + Claims []*Claim `protobuf:"bytes,1,rep,name=claims,proto3" json:"claims,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeUnprepareResourcesRequest) Reset() { *m = NodeUnprepareResourcesRequest{} } +func (*NodeUnprepareResourcesRequest) ProtoMessage() {} +func (*NodeUnprepareResourcesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{4} +} +func (m *NodeUnprepareResourcesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeUnprepareResourcesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodeUnprepareResourcesRequest.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 *NodeUnprepareResourcesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeUnprepareResourcesRequest.Merge(m, src) +} +func (m *NodeUnprepareResourcesRequest) XXX_Size() int { + return m.Size() +} +func (m *NodeUnprepareResourcesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NodeUnprepareResourcesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeUnprepareResourcesRequest proto.InternalMessageInfo + +func (m *NodeUnprepareResourcesRequest) GetClaims() []*Claim { + if m != nil { + return m.Claims + } + return nil +} + +type NodeUnprepareResourcesResponse struct { + // The ResourceClaims for which preparation was reverted. + // The same rules as for NodePrepareResourcesResponse.claims + // apply. In particular, all claims in the request must + // have an entry in the response, even if that entry is nil. + Claims map[string]*NodeUnprepareResourceResponse `protobuf:"bytes,1,rep,name=claims,proto3" json:"claims,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeUnprepareResourcesResponse) Reset() { *m = NodeUnprepareResourcesResponse{} } +func (*NodeUnprepareResourcesResponse) ProtoMessage() {} +func (*NodeUnprepareResourcesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{5} +} +func (m *NodeUnprepareResourcesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeUnprepareResourcesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodeUnprepareResourcesResponse.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 *NodeUnprepareResourcesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeUnprepareResourcesResponse.Merge(m, src) +} +func (m *NodeUnprepareResourcesResponse) XXX_Size() int { + return m.Size() +} +func (m *NodeUnprepareResourcesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NodeUnprepareResourcesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeUnprepareResourcesResponse proto.InternalMessageInfo + +func (m *NodeUnprepareResourcesResponse) GetClaims() map[string]*NodeUnprepareResourceResponse { + if m != nil { + return m.Claims + } + return nil +} + +type NodeUnprepareResourceResponse struct { + // If non-empty, unpreparing the ResourceClaim failed. + Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeUnprepareResourceResponse) Reset() { *m = NodeUnprepareResourceResponse{} } +func (*NodeUnprepareResourceResponse) ProtoMessage() {} +func (*NodeUnprepareResourceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{6} +} +func (m *NodeUnprepareResourceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeUnprepareResourceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodeUnprepareResourceResponse.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 *NodeUnprepareResourceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeUnprepareResourceResponse.Merge(m, src) +} +func (m *NodeUnprepareResourceResponse) XXX_Size() int { + return m.Size() +} +func (m *NodeUnprepareResourceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NodeUnprepareResourceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeUnprepareResourceResponse proto.InternalMessageInfo + +func (m *NodeUnprepareResourceResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +type Claim struct { + // The ResourceClaim namespace (ResourceClaim.meta.Namespace). + // This field is REQUIRED. + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + // The UID of the Resource claim (ResourceClaim.meta.UUID). + // This field is REQUIRED. + UID string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` + // The name of the Resource claim (ResourceClaim.meta.Name) + // This field is REQUIRED. + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Claim) Reset() { *m = Claim{} } +func (*Claim) ProtoMessage() {} +func (*Claim) Descriptor() ([]byte, []int) { + return fileDescriptor_00212fb1f9d3bf1c, []int{7} +} +func (m *Claim) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Claim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Claim.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 *Claim) XXX_Merge(src proto.Message) { + xxx_messageInfo_Claim.Merge(m, src) +} +func (m *Claim) XXX_Size() int { + return m.Size() +} +func (m *Claim) XXX_DiscardUnknown() { + xxx_messageInfo_Claim.DiscardUnknown(m) +} + +var xxx_messageInfo_Claim proto.InternalMessageInfo + +func (m *Claim) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + +func (m *Claim) GetUID() string { + if m != nil { + return m.UID + } + return "" +} + +func (m *Claim) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func init() { + proto.RegisterType((*NodePrepareResourcesRequest)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodePrepareResourcesRequest") + proto.RegisterType((*NodePrepareResourcesResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodePrepareResourcesResponse") + proto.RegisterMapType((map[string]*NodePrepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodePrepareResourcesResponse.ClaimsEntry") + proto.RegisterType((*NodePrepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodePrepareResourceResponse") + proto.RegisterType((*Device)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.Device") + proto.RegisterType((*NodeUnprepareResourcesRequest)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodeUnprepareResourcesRequest") + proto.RegisterType((*NodeUnprepareResourcesResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodeUnprepareResourcesResponse") + proto.RegisterMapType((map[string]*NodeUnprepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodeUnprepareResourcesResponse.ClaimsEntry") + proto.RegisterType((*NodeUnprepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.NodeUnprepareResourceResponse") + proto.RegisterType((*Claim)(nil), "k8s.io.kubelet.pkg.apis.dra.v1.Claim") +} + +func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) } + +var fileDescriptor_00212fb1f9d3bf1c = []byte{ + // 589 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0xad, 0xd7, 0xad, 0x23, 0xbf, 0x16, 0x34, 0x59, 0x13, 0x2a, 0xdd, 0x48, 0xab, 0x20, 0x50, + 0x2f, 0x24, 0x5a, 0x11, 0x68, 0x62, 0x2b, 0x82, 0xae, 0x48, 0x94, 0xc3, 0x34, 0x02, 0xbb, 0x20, + 0xc4, 0x48, 0x13, 0x13, 0xac, 0xfe, 0x71, 0xb0, 0x9b, 0x8a, 0xdd, 0xf8, 0x08, 0x48, 0x9c, 0x38, + 0xf3, 0x39, 0xb8, 0xef, 0xc8, 0x91, 0xd3, 0xc4, 0xc2, 0x97, 0xe0, 0x84, 0x50, 0xec, 0xb4, 0x94, + 0x29, 0x5d, 0x51, 0x27, 0x6e, 0xf6, 0xcf, 0xcf, 0xef, 0x3d, 0xfb, 0xf7, 0xe2, 0x80, 0xe6, 0x04, + 0xd4, 0x0c, 0x38, 0x1b, 0x30, 0xac, 0x77, 0x36, 0x85, 0x49, 0x99, 0xd9, 0x09, 0xdb, 0xa4, 0x4b, + 0x06, 0x66, 0xd0, 0xf1, 0x4d, 0x27, 0xa0, 0xc2, 0xf4, 0xb8, 0x63, 0x0e, 0x37, 0x4a, 0x37, 0x7d, + 0x3a, 0x78, 0x13, 0xb6, 0x4d, 0x97, 0xf5, 0x2c, 0x9f, 0xf9, 0xcc, 0x92, 0xdb, 0xda, 0xe1, 0x6b, + 0x39, 0x93, 0x13, 0x39, 0x52, 0x74, 0xc6, 0x0b, 0x58, 0xdb, 0x65, 0x1e, 0xd9, 0xe3, 0x24, 0x70, + 0x38, 0xb1, 0x89, 0x60, 0x21, 0x77, 0x89, 0xb0, 0xc9, 0xdb, 0x90, 0x88, 0x01, 0xae, 0x43, 0xce, + 0xed, 0x3a, 0xb4, 0x27, 0x8a, 0xa8, 0x92, 0xad, 0xe6, 0x6b, 0xd7, 0xcd, 0xb3, 0xe5, 0xcd, 0x9d, + 0x18, 0x6d, 0x27, 0x9b, 0x8c, 0x9f, 0x08, 0xd6, 0xd3, 0xe9, 0x45, 0xc0, 0xfa, 0x82, 0xe0, 0x57, + 0xa7, 0xf8, 0x1f, 0xcd, 0xe2, 0x3f, 0x8b, 0x4d, 0x89, 0x8b, 0x87, 0xfd, 0x01, 0x3f, 0x1c, 0x59, + 0x28, 0x0d, 0x21, 0x3f, 0x51, 0xc6, 0x2b, 0x90, 0xed, 0x90, 0xc3, 0x22, 0xaa, 0xa0, 0xaa, 0x66, + 0xc7, 0x43, 0xfc, 0x04, 0x96, 0x86, 0x4e, 0x37, 0x24, 0xc5, 0x85, 0x0a, 0xaa, 0xe6, 0x6b, 0x5b, + 0x73, 0x38, 0x18, 0x19, 0xb0, 0x15, 0xd3, 0xdd, 0x85, 0x4d, 0x64, 0x84, 0xa9, 0x17, 0x3b, 0x3e, + 0xf8, 0x7d, 0x58, 0xf6, 0xc8, 0x90, 0xba, 0x64, 0x74, 0xf2, 0x1b, 0xb3, 0x74, 0x9b, 0x12, 0x6e, + 0x8f, 0xb6, 0xe1, 0x55, 0x58, 0x22, 0x9c, 0x33, 0x2e, 0x7d, 0x6b, 0xb6, 0x9a, 0x18, 0x9f, 0x11, + 0xe4, 0x14, 0x12, 0x5f, 0x83, 0x8b, 0x5c, 0xb5, 0xf1, 0xa0, 0xef, 0xf4, 0x12, 0x21, 0xcd, 0x2e, + 0x24, 0xc5, 0xdd, 0xb8, 0x86, 0xd7, 0x40, 0x0b, 0x18, 0xeb, 0x4a, 0x44, 0xc2, 0x74, 0x21, 0x2e, + 0xc4, 0xab, 0xb8, 0x0c, 0x79, 0xa5, 0xa6, 0x96, 0xb3, 0x72, 0x19, 0x54, 0x49, 0x02, 0xee, 0xc0, + 0x25, 0xd7, 0xa3, 0x07, 0x09, 0x88, 0x7a, 0xa2, 0xb8, 0x18, 0x6b, 0x34, 0x56, 0xa2, 0xe3, 0x72, + 0x61, 0xa7, 0xd9, 0x52, 0x4e, 0x5a, 0x4d, 0x61, 0x17, 0x5c, 0x8f, 0x26, 0x33, 0x4f, 0x18, 0x2f, + 0xe1, 0x6a, 0x7c, 0x39, 0xfb, 0xfd, 0xe0, 0xff, 0xe4, 0xee, 0x17, 0x02, 0x7d, 0x9a, 0x40, 0xd2, + 0x80, 0xf6, 0x29, 0x85, 0xc7, 0xff, 0xd2, 0xf7, 0xe9, 0x7c, 0xa9, 0xd9, 0x7b, 0x37, 0x2b, 0x7b, + 0x4f, 0xff, 0xce, 0x5e, 0x7d, 0x2e, 0x0f, 0x69, 0xe9, 0xbb, 0x3d, 0xe5, 0x82, 0xc7, 0xc7, 0x1f, + 0xa7, 0x07, 0x4d, 0xa6, 0xe7, 0x19, 0x2c, 0x49, 0xc3, 0x78, 0x1d, 0x34, 0x99, 0x99, 0xc0, 0x71, + 0x49, 0x02, 0xf9, 0x53, 0xc0, 0x57, 0x20, 0x1b, 0x52, 0x4f, 0xc5, 0xa5, 0xb1, 0x1c, 0x1d, 0x97, + 0xb3, 0xfb, 0xad, 0xa6, 0x1d, 0xd7, 0x30, 0x86, 0xc5, 0x89, 0xac, 0xc8, 0x71, 0xed, 0xcb, 0x02, + 0x68, 0x4d, 0xfb, 0xc1, 0x5e, 0x37, 0xf4, 0x69, 0x1f, 0x7f, 0x44, 0xb0, 0x9a, 0xf6, 0x15, 0xe3, + 0xad, 0xf9, 0xbe, 0x7d, 0x19, 0x98, 0xd2, 0xf6, 0x79, 0x1e, 0x0e, 0x23, 0x83, 0x3f, 0x21, 0xb8, + 0x9c, 0xde, 0x61, 0x5c, 0x9f, 0x37, 0x19, 0xca, 0xd9, 0xbd, 0xf3, 0x05, 0xcb, 0xc8, 0x34, 0xb6, + 0x8f, 0x4e, 0x74, 0xf4, 0xed, 0x44, 0xcf, 0xbc, 0x8f, 0x74, 0x74, 0x14, 0xe9, 0xe8, 0x6b, 0xa4, + 0xa3, 0xef, 0x91, 0x8e, 0x3e, 0xfc, 0xd0, 0x33, 0xcf, 0x93, 0x1f, 0x82, 0x95, 0xd0, 0x5b, 0x41, + 0xc7, 0xb7, 0x62, 0x7a, 0xcb, 0xe3, 0x8e, 0x35, 0xdc, 0x68, 0xe7, 0xe4, 0x43, 0x7f, 0xeb, 0x77, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x9a, 0x7f, 0xfc, 0x44, 0x06, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// DRAPluginClient is the client API for DRAPlugin service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type DRAPluginClient interface { + // NodePrepareResources prepares several ResourceClaims + // for use on the node. If an error is returned, the + // response is ignored. Failures for individual claims + // can be reported inside NodePrepareResourcesResponse. + NodePrepareResources(ctx context.Context, in *NodePrepareResourcesRequest, opts ...grpc.CallOption) (*NodePrepareResourcesResponse, error) + // NodeUnprepareResources is the opposite of NodePrepareResources. + // The same error handling rules apply, + NodeUnprepareResources(ctx context.Context, in *NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*NodeUnprepareResourcesResponse, error) +} + +type dRAPluginClient struct { + cc *grpc.ClientConn +} + +func NewDRAPluginClient(cc *grpc.ClientConn) DRAPluginClient { + return &dRAPluginClient{cc} +} + +func (c *dRAPluginClient) NodePrepareResources(ctx context.Context, in *NodePrepareResourcesRequest, opts ...grpc.CallOption) (*NodePrepareResourcesResponse, error) { + out := new(NodePrepareResourcesResponse) + err := c.cc.Invoke(ctx, "/k8s.io.kubelet.pkg.apis.dra.v1.DRAPlugin/NodePrepareResources", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dRAPluginClient) NodeUnprepareResources(ctx context.Context, in *NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*NodeUnprepareResourcesResponse, error) { + out := new(NodeUnprepareResourcesResponse) + err := c.cc.Invoke(ctx, "/k8s.io.kubelet.pkg.apis.dra.v1.DRAPlugin/NodeUnprepareResources", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DRAPluginServer is the server API for DRAPlugin service. +type DRAPluginServer interface { + // NodePrepareResources prepares several ResourceClaims + // for use on the node. If an error is returned, the + // response is ignored. Failures for individual claims + // can be reported inside NodePrepareResourcesResponse. + NodePrepareResources(context.Context, *NodePrepareResourcesRequest) (*NodePrepareResourcesResponse, error) + // NodeUnprepareResources is the opposite of NodePrepareResources. + // The same error handling rules apply, + NodeUnprepareResources(context.Context, *NodeUnprepareResourcesRequest) (*NodeUnprepareResourcesResponse, error) +} + +// UnimplementedDRAPluginServer can be embedded to have forward compatible implementations. +type UnimplementedDRAPluginServer struct { +} + +func (*UnimplementedDRAPluginServer) NodePrepareResources(ctx context.Context, req *NodePrepareResourcesRequest) (*NodePrepareResourcesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NodePrepareResources not implemented") +} +func (*UnimplementedDRAPluginServer) NodeUnprepareResources(ctx context.Context, req *NodeUnprepareResourcesRequest) (*NodeUnprepareResourcesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NodeUnprepareResources not implemented") +} + +func RegisterDRAPluginServer(s *grpc.Server, srv DRAPluginServer) { + s.RegisterService(&_DRAPlugin_serviceDesc, srv) +} + +func _DRAPlugin_NodePrepareResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NodePrepareResourcesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DRAPluginServer).NodePrepareResources(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/k8s.io.kubelet.pkg.apis.dra.v1.DRAPlugin/NodePrepareResources", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DRAPluginServer).NodePrepareResources(ctx, req.(*NodePrepareResourcesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DRAPlugin_NodeUnprepareResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NodeUnprepareResourcesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DRAPluginServer).NodeUnprepareResources(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/k8s.io.kubelet.pkg.apis.dra.v1.DRAPlugin/NodeUnprepareResources", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DRAPluginServer).NodeUnprepareResources(ctx, req.(*NodeUnprepareResourcesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _DRAPlugin_serviceDesc = grpc.ServiceDesc{ + ServiceName: "k8s.io.kubelet.pkg.apis.dra.v1.DRAPlugin", + HandlerType: (*DRAPluginServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NodePrepareResources", + Handler: _DRAPlugin_NodePrepareResources_Handler, + }, + { + MethodName: "NodeUnprepareResources", + Handler: _DRAPlugin_NodeUnprepareResources_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api.proto", +} + +func (m *NodePrepareResourcesRequest) 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 *NodePrepareResourcesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodePrepareResourcesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Claims) > 0 { + for iNdEx := len(m.Claims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Claims[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 *NodePrepareResourcesResponse) 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 *NodePrepareResourcesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodePrepareResourcesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Claims) > 0 { + for k := range m.Claims { + v := m.Claims[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintApi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintApi(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintApi(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *NodePrepareResourceResponse) 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 *NodePrepareResourceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodePrepareResourceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintApi(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x12 + } + if len(m.Devices) > 0 { + for iNdEx := len(m.Devices) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Devices[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 *Device) 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 *Device) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CDIDeviceIDs) > 0 { + for iNdEx := len(m.CDIDeviceIDs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CDIDeviceIDs[iNdEx]) + copy(dAtA[i:], m.CDIDeviceIDs[iNdEx]) + i = encodeVarintApi(dAtA, i, uint64(len(m.CDIDeviceIDs[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.DeviceName) > 0 { + i -= len(m.DeviceName) + copy(dAtA[i:], m.DeviceName) + i = encodeVarintApi(dAtA, i, uint64(len(m.DeviceName))) + i-- + dAtA[i] = 0x1a + } + if len(m.PoolName) > 0 { + i -= len(m.PoolName) + copy(dAtA[i:], m.PoolName) + i = encodeVarintApi(dAtA, i, uint64(len(m.PoolName))) + i-- + dAtA[i] = 0x12 + } + if len(m.RequestNames) > 0 { + for iNdEx := len(m.RequestNames) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RequestNames[iNdEx]) + copy(dAtA[i:], m.RequestNames[iNdEx]) + i = encodeVarintApi(dAtA, i, uint64(len(m.RequestNames[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *NodeUnprepareResourcesRequest) 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 *NodeUnprepareResourcesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeUnprepareResourcesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Claims) > 0 { + for iNdEx := len(m.Claims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Claims[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 *NodeUnprepareResourcesResponse) 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 *NodeUnprepareResourcesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeUnprepareResourcesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Claims) > 0 { + for k := range m.Claims { + v := m.Claims[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintApi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintApi(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintApi(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *NodeUnprepareResourceResponse) 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 *NodeUnprepareResourceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeUnprepareResourceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintApi(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Claim) 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 *Claim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Claim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintApi(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.UID) > 0 { + i -= len(m.UID) + copy(dAtA[i:], m.UID) + i = encodeVarintApi(dAtA, i, uint64(len(m.UID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Namespace) > 0 { + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintApi(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintApi(dAtA []byte, offset int, v uint64) int { + offset -= sovApi(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NodePrepareResourcesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Claims) > 0 { + for _, e := range m.Claims { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *NodePrepareResourcesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Claims) > 0 { + for k, v := range m.Claims { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovApi(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovApi(uint64(len(k))) + l + n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) + } + } + return n +} + +func (m *NodePrepareResourceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Devices) > 0 { + for _, e := range m.Devices { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func (m *Device) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RequestNames) > 0 { + for _, s := range m.RequestNames { + l = len(s) + n += 1 + l + sovApi(uint64(l)) + } + } + l = len(m.PoolName) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.DeviceName) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + if len(m.CDIDeviceIDs) > 0 { + for _, s := range m.CDIDeviceIDs { + l = len(s) + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *NodeUnprepareResourcesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Claims) > 0 { + for _, e := range m.Claims { + l = e.Size() + n += 1 + l + sovApi(uint64(l)) + } + } + return n +} + +func (m *NodeUnprepareResourcesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Claims) > 0 { + for k, v := range m.Claims { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovApi(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovApi(uint64(len(k))) + l + n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) + } + } + return n +} + +func (m *NodeUnprepareResourceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Error) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func (m *Claim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Namespace) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.UID) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovApi(uint64(l)) + } + return n +} + +func sovApi(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozApi(x uint64) (n int) { + return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *NodePrepareResourcesRequest) String() string { + if this == nil { + return "nil" + } + repeatedStringForClaims := "[]*Claim{" + for _, f := range this.Claims { + repeatedStringForClaims += strings.Replace(f.String(), "Claim", "Claim", 1) + "," + } + repeatedStringForClaims += "}" + s := strings.Join([]string{`&NodePrepareResourcesRequest{`, + `Claims:` + repeatedStringForClaims + `,`, + `}`, + }, "") + return s +} +func (this *NodePrepareResourcesResponse) String() string { + if this == nil { + return "nil" + } + keysForClaims := make([]string, 0, len(this.Claims)) + for k := range this.Claims { + keysForClaims = append(keysForClaims, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForClaims) + mapStringForClaims := "map[string]*NodePrepareResourceResponse{" + for _, k := range keysForClaims { + mapStringForClaims += fmt.Sprintf("%v: %v,", k, this.Claims[k]) + } + mapStringForClaims += "}" + s := strings.Join([]string{`&NodePrepareResourcesResponse{`, + `Claims:` + mapStringForClaims + `,`, + `}`, + }, "") + return s +} +func (this *NodePrepareResourceResponse) String() string { + if this == nil { + return "nil" + } + repeatedStringForDevices := "[]*Device{" + for _, f := range this.Devices { + repeatedStringForDevices += strings.Replace(f.String(), "Device", "Device", 1) + "," + } + repeatedStringForDevices += "}" + s := strings.Join([]string{`&NodePrepareResourceResponse{`, + `Devices:` + repeatedStringForDevices + `,`, + `Error:` + fmt.Sprintf("%v", this.Error) + `,`, + `}`, + }, "") + return s +} +func (this *Device) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Device{`, + `RequestNames:` + fmt.Sprintf("%v", this.RequestNames) + `,`, + `PoolName:` + fmt.Sprintf("%v", this.PoolName) + `,`, + `DeviceName:` + fmt.Sprintf("%v", this.DeviceName) + `,`, + `CDIDeviceIDs:` + fmt.Sprintf("%v", this.CDIDeviceIDs) + `,`, + `}`, + }, "") + return s +} +func (this *NodeUnprepareResourcesRequest) String() string { + if this == nil { + return "nil" + } + repeatedStringForClaims := "[]*Claim{" + for _, f := range this.Claims { + repeatedStringForClaims += strings.Replace(f.String(), "Claim", "Claim", 1) + "," + } + repeatedStringForClaims += "}" + s := strings.Join([]string{`&NodeUnprepareResourcesRequest{`, + `Claims:` + repeatedStringForClaims + `,`, + `}`, + }, "") + return s +} +func (this *NodeUnprepareResourcesResponse) String() string { + if this == nil { + return "nil" + } + keysForClaims := make([]string, 0, len(this.Claims)) + for k := range this.Claims { + keysForClaims = append(keysForClaims, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForClaims) + mapStringForClaims := "map[string]*NodeUnprepareResourceResponse{" + for _, k := range keysForClaims { + mapStringForClaims += fmt.Sprintf("%v: %v,", k, this.Claims[k]) + } + mapStringForClaims += "}" + s := strings.Join([]string{`&NodeUnprepareResourcesResponse{`, + `Claims:` + mapStringForClaims + `,`, + `}`, + }, "") + return s +} +func (this *NodeUnprepareResourceResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeUnprepareResourceResponse{`, + `Error:` + fmt.Sprintf("%v", this.Error) + `,`, + `}`, + }, "") + return s +} +func (this *Claim) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Claim{`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `UID:` + fmt.Sprintf("%v", this.UID) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func valueToStringApi(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *NodePrepareResourcesRequest) 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: NodePrepareResourcesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodePrepareResourcesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claims", 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.Claims = append(m.Claims, &Claim{}) + if err := m.Claims[len(m.Claims)-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 *NodePrepareResourcesResponse) 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: NodePrepareResourcesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodePrepareResourcesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claims", 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 + } + if m.Claims == nil { + m.Claims = make(map[string]*NodePrepareResourceResponse) + } + var mapkey string + var mapvalue *NodePrepareResourceResponse + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthApi + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthApi + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthApi + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &NodePrepareResourceResponse{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Claims[mapkey] = mapvalue + 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 *NodePrepareResourceResponse) 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: NodePrepareResourceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodePrepareResourceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Devices", 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.Devices = append(m.Devices, &Device{}) + if err := m.Devices[len(m.Devices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + 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 *Device) 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: Device: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Device: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestNames", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestNames = append(m.RequestNames, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeviceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DeviceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CDIDeviceIDs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CDIDeviceIDs = append(m.CDIDeviceIDs, string(dAtA[iNdEx:postIndex])) + 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 *NodeUnprepareResourcesRequest) 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: NodeUnprepareResourcesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeUnprepareResourcesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claims", 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.Claims = append(m.Claims, &Claim{}) + if err := m.Claims[len(m.Claims)-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 *NodeUnprepareResourcesResponse) 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: NodeUnprepareResourcesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeUnprepareResourcesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claims", 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 + } + if m.Claims == nil { + m.Claims = make(map[string]*NodeUnprepareResourceResponse) + } + var mapkey string + var mapvalue *NodeUnprepareResourceResponse + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthApi + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthApi + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthApi + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthApi + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &NodeUnprepareResourceResponse{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipApi(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthApi + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Claims[mapkey] = mapvalue + 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 *NodeUnprepareResourceResponse) 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: NodeUnprepareResourceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeUnprepareResourceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + 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 + 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: Claim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Claim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowApi + } + 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 ErrInvalidLengthApi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthApi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + 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 skipApi(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowApi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthApi + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupApi + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthApi + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupApi = fmt.Errorf("proto: unexpected end of group") +) diff --git a/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/api.proto b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/api.proto new file mode 100644 index 00000000000..a23d1a5a49a --- /dev/null +++ b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/api.proto @@ -0,0 +1,118 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// To regenerate api.pb.go run `hack/update-codegen.sh protobindings` + +syntax = "proto3"; + +package k8s.io.kubelet.pkg.apis.dra.v1; +option go_package = "k8s.io/kubelet/pkg/apis/dra/v1"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = true; +option (gogoproto.goproto_getters_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.goproto_unrecognized_all) = false; + +service DRAPlugin { + // NodePrepareResources prepares several ResourceClaims + // for use on the node. If an error is returned, the + // response is ignored. Failures for individual claims + // can be reported inside NodePrepareResourcesResponse. + rpc NodePrepareResources (NodePrepareResourcesRequest) + returns (NodePrepareResourcesResponse) {} + + // NodeUnprepareResources is the opposite of NodePrepareResources. + // The same error handling rules apply, + rpc NodeUnprepareResources (NodeUnprepareResourcesRequest) + returns (NodeUnprepareResourcesResponse) {} +} + +message NodePrepareResourcesRequest { + // The list of ResourceClaims that are to be prepared. + repeated Claim claims = 1; +} + +message NodePrepareResourcesResponse { + // The ResourceClaims for which preparation was done + // or attempted, with claim_uid as key. + // + // It is an error if some claim listed in NodePrepareResourcesRequest + // does not get prepared. NodePrepareResources + // will be called again for those that are missing. + map claims = 1; +} + +message NodePrepareResourceResponse { + // These are the additional devices that kubelet must + // make available via the container runtime. A claim + // may have zero or more requests and each request + // may have zero or more devices. + repeated Device devices = 1; + // If non-empty, preparing the ResourceClaim failed. + // Devices are ignored in that case. + string error = 2; +} + +message Device { + // The requests in the claim that this device is associated with. + // Optional. If empty, the device is associated with all requests. + repeated string request_names = 1; + + // The pool which contains the device. Required. + string pool_name = 2; + + // The device itself. Required. + string device_name = 3; + + // A single device instance may map to several CDI device IDs. + // None is also valid. + repeated string cdi_device_ids = 4 [(gogoproto.customname) = "CDIDeviceIDs"]; +} + +message NodeUnprepareResourcesRequest { + // The list of ResourceClaims that are to be unprepared. + repeated Claim claims = 1; +} + +message NodeUnprepareResourcesResponse { + // The ResourceClaims for which preparation was reverted. + // The same rules as for NodePrepareResourcesResponse.claims + // apply. In particular, all claims in the request must + // have an entry in the response, even if that entry is nil. + map claims = 1; +} + +message NodeUnprepareResourceResponse { + // If non-empty, unpreparing the ResourceClaim failed. + string error = 1; +} + +message Claim { + // The ResourceClaim namespace (ResourceClaim.meta.Namespace). + // This field is REQUIRED. + string namespace = 1; + // The UID of the Resource claim (ResourceClaim.meta.UUID). + // This field is REQUIRED. + string uid = 2 [(gogoproto.customname) = "UID"]; + // The name of the Resource claim (ResourceClaim.meta.Name) + // This field is REQUIRED. + string name = 3; +} diff --git a/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/types.go b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/types.go new file mode 100644 index 00000000000..e8ed148e08a --- /dev/null +++ b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1/types.go @@ -0,0 +1,24 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +const ( + // DRAPluginService needs to be listed in the "supported versions" + // array during plugin registration by a DRA plugin which provides + // an implementation of the v1 DRAPlugin service. + DRAPluginService = "v1.DRAPlugin" +) diff --git a/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/conversion.go b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/conversion.go new file mode 100644 index 00000000000..bee12052a5a --- /dev/null +++ b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/conversion.go @@ -0,0 +1,188 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + context "context" + fmt "fmt" + + grpc "google.golang.org/grpc" + "k8s.io/apimachinery/pkg/runtime" + + v1 "k8s.io/kubelet/pkg/apis/dra/v1" +) + +var ( + localSchemeBuilder runtime.SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// V1ServerWrapper implements the [NodeServer] interface by wrapping a [v1.DRAPluginServer]. +type V1ServerWrapper struct { + v1.DRAPluginServer +} + +var _ DRAPluginServer = V1ServerWrapper{} + +func (w V1ServerWrapper) NodePrepareResources(ctx context.Context, req *NodePrepareResourcesRequest) (*NodePrepareResourcesResponse, error) { + var convertedReq v1.NodePrepareResourcesRequest + if err := Convert_v1beta1_NodePrepareResourcesRequest_To_v1_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1beta1 to v1: %w", err) + } + resp, err := w.DRAPluginServer.NodePrepareResources(ctx, &convertedReq) + if err != nil { + return nil, err + } + var convertedResp NodePrepareResourcesResponse + if err := Convert_v1_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1 to v1beta1: %w", err) + } + return &convertedResp, nil +} + +func (w V1ServerWrapper) NodeUnprepareResources(ctx context.Context, req *NodeUnprepareResourcesRequest) (*NodeUnprepareResourcesResponse, error) { + var convertedReq v1.NodeUnprepareResourcesRequest + if err := Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1beta1 to v1: %w", err) + } + resp, err := w.DRAPluginServer.NodeUnprepareResources(ctx, &convertedReq) + if err != nil { + return nil, err + } + var convertedResp NodeUnprepareResourcesResponse + if err := Convert_v1_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1 to v1beta1: %w", err) + } + return &convertedResp, nil +} + +// V1Beta1ServerWrapper implements the [v1.DRAPluginServer] interface by wrapping a [NodeServer]. +type V1Beta1ServerWrapper struct { + DRAPluginServer +} + +var _ v1.DRAPluginServer = V1Beta1ServerWrapper{} + +func (w V1Beta1ServerWrapper) NodePrepareResources(ctx context.Context, req *v1.NodePrepareResourcesRequest) (*v1.NodePrepareResourcesResponse, error) { + var convertedReq NodePrepareResourcesRequest + if err := Convert_v1_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1 to v1beta1: %w", err) + } + resp, err := w.DRAPluginServer.NodePrepareResources(ctx, &convertedReq) + if err != nil { + return nil, err + } + var convertedResp v1.NodePrepareResourcesResponse + if err := Convert_v1beta1_NodePrepareResourcesResponse_To_v1_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1beta1 to v1: %w", err) + } + return &convertedResp, nil +} + +func (w V1Beta1ServerWrapper) NodeUnprepareResources(ctx context.Context, req *v1.NodeUnprepareResourcesRequest) (*v1.NodeUnprepareResourcesResponse, error) { + var convertedReq NodeUnprepareResourcesRequest + if err := Convert_v1_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1 to v1beta1: %w", err) + } + resp, err := w.DRAPluginServer.NodeUnprepareResources(ctx, &convertedReq) + if err != nil { + return nil, err + } + var convertedResp v1.NodeUnprepareResourcesResponse + if err := Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1beta1 to v1: %w", err) + } + return &convertedResp, nil +} + +// V1ClientWrapper implements the [NodeClient] interface by wrapping a [v1.DRAPluginClient]. +type V1ClientWrapper struct { + v1.DRAPluginClient +} + +var _ DRAPluginClient = V1ClientWrapper{} + +func (w V1ClientWrapper) NodePrepareResources(ctx context.Context, req *NodePrepareResourcesRequest, options ...grpc.CallOption) (*NodePrepareResourcesResponse, error) { + var convertedReq v1.NodePrepareResourcesRequest + if err := Convert_v1beta1_NodePrepareResourcesRequest_To_v1_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1beta1 to v1: %w", err) + } + resp, err := w.DRAPluginClient.NodePrepareResources(ctx, &convertedReq, options...) + if err != nil { + return nil, err + } + var convertedResp NodePrepareResourcesResponse + if err := Convert_v1_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1 to v1beta1: %w", err) + } + return &convertedResp, nil +} + +func (w V1ClientWrapper) NodeUnprepareResources(ctx context.Context, req *NodeUnprepareResourcesRequest, options ...grpc.CallOption) (*NodeUnprepareResourcesResponse, error) { + var convertedReq v1.NodeUnprepareResourcesRequest + if err := Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1beta1 to v1: %w", err) + } + resp, err := w.DRAPluginClient.NodeUnprepareResources(ctx, &convertedReq, options...) + if err != nil { + return nil, err + } + var convertedResp NodeUnprepareResourcesResponse + if err := Convert_v1_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1 to v1beta1: %w", err) + } + return &convertedResp, nil +} + +// V1Beta1ClientWrapper implements the [v1.DRAPluginClient] interface by wrapping a [NodeClient]. +type V1Beta1ClientWrapper struct { + DRAPluginClient +} + +var _ v1.DRAPluginClient = V1Beta1ClientWrapper{} + +func (w V1Beta1ClientWrapper) NodePrepareResources(ctx context.Context, req *v1.NodePrepareResourcesRequest, options ...grpc.CallOption) (*v1.NodePrepareResourcesResponse, error) { + var convertedReq NodePrepareResourcesRequest + if err := Convert_v1_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1 to v1beta1: %w", err) + } + resp, err := w.DRAPluginClient.NodePrepareResources(ctx, &convertedReq, options...) + if err != nil { + return nil, err + } + var convertedResp v1.NodePrepareResourcesResponse + if err := Convert_v1beta1_NodePrepareResourcesResponse_To_v1_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1beta1 to v1: %w", err) + } + return &convertedResp, nil +} + +func (w V1Beta1ClientWrapper) NodeUnprepareResources(ctx context.Context, req *v1.NodeUnprepareResourcesRequest, options ...grpc.CallOption) (*v1.NodeUnprepareResourcesResponse, error) { + var convertedReq NodeUnprepareResourcesRequest + if err := Convert_v1_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1 to v1beta1: %w", err) + } + resp, err := w.DRAPluginClient.NodeUnprepareResources(ctx, &convertedReq, options...) + if err != nil { + return nil, err + } + var convertedResp v1.NodeUnprepareResourcesResponse + if err := Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil { + return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1beta1 to v1: %w", err) + } + return &convertedResp, nil +} diff --git a/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/doc.go b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/doc.go new file mode 100644 index 00000000000..6956c656f20 --- /dev/null +++ b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1beta1 contains a legacy implementation of the DRA gRPC +// interface. Support for it in kubelet is provided via conversion. +// +// +k8s:conversion-gen=k8s.io/kubelet/pkg/apis/dra/v1 +package v1beta1 diff --git a/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/zz_generated.conversion.go b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/zz_generated.conversion.go new file mode 100644 index 00000000000..4938f87e86e --- /dev/null +++ b/staging/src/k8s.io/kubelet/pkg/apis/dra/v1beta1/zz_generated.conversion.go @@ -0,0 +1,352 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1beta1 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + v1 "k8s.io/kubelet/pkg/apis/dra/v1" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Claim)(nil), (*v1.Claim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_Claim_To_v1_Claim(a.(*Claim), b.(*v1.Claim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.Claim)(nil), (*Claim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Claim_To_v1beta1_Claim(a.(*v1.Claim), b.(*Claim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Device)(nil), (*v1.Device)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_Device_To_v1_Device(a.(*Device), b.(*v1.Device), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.Device)(nil), (*Device)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Device_To_v1beta1_Device(a.(*v1.Device), b.(*Device), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodePrepareResourceResponse)(nil), (*v1.NodePrepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodePrepareResourceResponse_To_v1_NodePrepareResourceResponse(a.(*NodePrepareResourceResponse), b.(*v1.NodePrepareResourceResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.NodePrepareResourceResponse)(nil), (*NodePrepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(a.(*v1.NodePrepareResourceResponse), b.(*NodePrepareResourceResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodePrepareResourcesRequest)(nil), (*v1.NodePrepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodePrepareResourcesRequest_To_v1_NodePrepareResourcesRequest(a.(*NodePrepareResourcesRequest), b.(*v1.NodePrepareResourcesRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.NodePrepareResourcesRequest)(nil), (*NodePrepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(a.(*v1.NodePrepareResourcesRequest), b.(*NodePrepareResourcesRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodePrepareResourcesResponse)(nil), (*v1.NodePrepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodePrepareResourcesResponse_To_v1_NodePrepareResourcesResponse(a.(*NodePrepareResourcesResponse), b.(*v1.NodePrepareResourcesResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.NodePrepareResourcesResponse)(nil), (*NodePrepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(a.(*v1.NodePrepareResourcesResponse), b.(*NodePrepareResourcesResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeUnprepareResourceResponse)(nil), (*v1.NodeUnprepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodeUnprepareResourceResponse_To_v1_NodeUnprepareResourceResponse(a.(*NodeUnprepareResourceResponse), b.(*v1.NodeUnprepareResourceResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.NodeUnprepareResourceResponse)(nil), (*NodeUnprepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(a.(*v1.NodeUnprepareResourceResponse), b.(*NodeUnprepareResourceResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeUnprepareResourcesRequest)(nil), (*v1.NodeUnprepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1_NodeUnprepareResourcesRequest(a.(*NodeUnprepareResourcesRequest), b.(*v1.NodeUnprepareResourcesRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.NodeUnprepareResourcesRequest)(nil), (*NodeUnprepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(a.(*v1.NodeUnprepareResourcesRequest), b.(*NodeUnprepareResourcesRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeUnprepareResourcesResponse)(nil), (*v1.NodeUnprepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1_NodeUnprepareResourcesResponse(a.(*NodeUnprepareResourcesResponse), b.(*v1.NodeUnprepareResourcesResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.NodeUnprepareResourcesResponse)(nil), (*NodeUnprepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(a.(*v1.NodeUnprepareResourcesResponse), b.(*NodeUnprepareResourcesResponse), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*UnimplementedDRAPluginServer)(nil), (*v1.UnimplementedDRAPluginServer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_UnimplementedDRAPluginServer_To_v1_UnimplementedDRAPluginServer(a.(*UnimplementedDRAPluginServer), b.(*v1.UnimplementedDRAPluginServer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1.UnimplementedDRAPluginServer)(nil), (*UnimplementedDRAPluginServer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_UnimplementedDRAPluginServer_To_v1beta1_UnimplementedDRAPluginServer(a.(*v1.UnimplementedDRAPluginServer), b.(*UnimplementedDRAPluginServer), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1beta1_Claim_To_v1_Claim(in *Claim, out *v1.Claim, s conversion.Scope) error { + out.Namespace = in.Namespace + out.UID = in.UID + out.Name = in.Name + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_Claim_To_v1_Claim is an autogenerated conversion function. +func Convert_v1beta1_Claim_To_v1_Claim(in *Claim, out *v1.Claim, s conversion.Scope) error { + return autoConvert_v1beta1_Claim_To_v1_Claim(in, out, s) +} + +func autoConvert_v1_Claim_To_v1beta1_Claim(in *v1.Claim, out *Claim, s conversion.Scope) error { + out.Namespace = in.Namespace + out.UID = in.UID + out.Name = in.Name + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_Claim_To_v1beta1_Claim is an autogenerated conversion function. +func Convert_v1_Claim_To_v1beta1_Claim(in *v1.Claim, out *Claim, s conversion.Scope) error { + return autoConvert_v1_Claim_To_v1beta1_Claim(in, out, s) +} + +func autoConvert_v1beta1_Device_To_v1_Device(in *Device, out *v1.Device, s conversion.Scope) error { + out.RequestNames = *(*[]string)(unsafe.Pointer(&in.RequestNames)) + out.PoolName = in.PoolName + out.DeviceName = in.DeviceName + out.CDIDeviceIDs = *(*[]string)(unsafe.Pointer(&in.CDIDeviceIDs)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_Device_To_v1_Device is an autogenerated conversion function. +func Convert_v1beta1_Device_To_v1_Device(in *Device, out *v1.Device, s conversion.Scope) error { + return autoConvert_v1beta1_Device_To_v1_Device(in, out, s) +} + +func autoConvert_v1_Device_To_v1beta1_Device(in *v1.Device, out *Device, s conversion.Scope) error { + out.RequestNames = *(*[]string)(unsafe.Pointer(&in.RequestNames)) + out.PoolName = in.PoolName + out.DeviceName = in.DeviceName + out.CDIDeviceIDs = *(*[]string)(unsafe.Pointer(&in.CDIDeviceIDs)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_Device_To_v1beta1_Device is an autogenerated conversion function. +func Convert_v1_Device_To_v1beta1_Device(in *v1.Device, out *Device, s conversion.Scope) error { + return autoConvert_v1_Device_To_v1beta1_Device(in, out, s) +} + +func autoConvert_v1beta1_NodePrepareResourceResponse_To_v1_NodePrepareResourceResponse(in *NodePrepareResourceResponse, out *v1.NodePrepareResourceResponse, s conversion.Scope) error { + out.Devices = *(*[]*v1.Device)(unsafe.Pointer(&in.Devices)) + out.Error = in.Error + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_NodePrepareResourceResponse_To_v1_NodePrepareResourceResponse is an autogenerated conversion function. +func Convert_v1beta1_NodePrepareResourceResponse_To_v1_NodePrepareResourceResponse(in *NodePrepareResourceResponse, out *v1.NodePrepareResourceResponse, s conversion.Scope) error { + return autoConvert_v1beta1_NodePrepareResourceResponse_To_v1_NodePrepareResourceResponse(in, out, s) +} + +func autoConvert_v1_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(in *v1.NodePrepareResourceResponse, out *NodePrepareResourceResponse, s conversion.Scope) error { + out.Devices = *(*[]*Device)(unsafe.Pointer(&in.Devices)) + out.Error = in.Error + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse is an autogenerated conversion function. +func Convert_v1_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(in *v1.NodePrepareResourceResponse, out *NodePrepareResourceResponse, s conversion.Scope) error { + return autoConvert_v1_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(in, out, s) +} + +func autoConvert_v1beta1_NodePrepareResourcesRequest_To_v1_NodePrepareResourcesRequest(in *NodePrepareResourcesRequest, out *v1.NodePrepareResourcesRequest, s conversion.Scope) error { + out.Claims = *(*[]*v1.Claim)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_NodePrepareResourcesRequest_To_v1_NodePrepareResourcesRequest is an autogenerated conversion function. +func Convert_v1beta1_NodePrepareResourcesRequest_To_v1_NodePrepareResourcesRequest(in *NodePrepareResourcesRequest, out *v1.NodePrepareResourcesRequest, s conversion.Scope) error { + return autoConvert_v1beta1_NodePrepareResourcesRequest_To_v1_NodePrepareResourcesRequest(in, out, s) +} + +func autoConvert_v1_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(in *v1.NodePrepareResourcesRequest, out *NodePrepareResourcesRequest, s conversion.Scope) error { + out.Claims = *(*[]*Claim)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest is an autogenerated conversion function. +func Convert_v1_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(in *v1.NodePrepareResourcesRequest, out *NodePrepareResourcesRequest, s conversion.Scope) error { + return autoConvert_v1_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(in, out, s) +} + +func autoConvert_v1beta1_NodePrepareResourcesResponse_To_v1_NodePrepareResourcesResponse(in *NodePrepareResourcesResponse, out *v1.NodePrepareResourcesResponse, s conversion.Scope) error { + out.Claims = *(*map[string]*v1.NodePrepareResourceResponse)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_NodePrepareResourcesResponse_To_v1_NodePrepareResourcesResponse is an autogenerated conversion function. +func Convert_v1beta1_NodePrepareResourcesResponse_To_v1_NodePrepareResourcesResponse(in *NodePrepareResourcesResponse, out *v1.NodePrepareResourcesResponse, s conversion.Scope) error { + return autoConvert_v1beta1_NodePrepareResourcesResponse_To_v1_NodePrepareResourcesResponse(in, out, s) +} + +func autoConvert_v1_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(in *v1.NodePrepareResourcesResponse, out *NodePrepareResourcesResponse, s conversion.Scope) error { + out.Claims = *(*map[string]*NodePrepareResourceResponse)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse is an autogenerated conversion function. +func Convert_v1_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(in *v1.NodePrepareResourcesResponse, out *NodePrepareResourcesResponse, s conversion.Scope) error { + return autoConvert_v1_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(in, out, s) +} + +func autoConvert_v1beta1_NodeUnprepareResourceResponse_To_v1_NodeUnprepareResourceResponse(in *NodeUnprepareResourceResponse, out *v1.NodeUnprepareResourceResponse, s conversion.Scope) error { + out.Error = in.Error + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_NodeUnprepareResourceResponse_To_v1_NodeUnprepareResourceResponse is an autogenerated conversion function. +func Convert_v1beta1_NodeUnprepareResourceResponse_To_v1_NodeUnprepareResourceResponse(in *NodeUnprepareResourceResponse, out *v1.NodeUnprepareResourceResponse, s conversion.Scope) error { + return autoConvert_v1beta1_NodeUnprepareResourceResponse_To_v1_NodeUnprepareResourceResponse(in, out, s) +} + +func autoConvert_v1_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(in *v1.NodeUnprepareResourceResponse, out *NodeUnprepareResourceResponse, s conversion.Scope) error { + out.Error = in.Error + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse is an autogenerated conversion function. +func Convert_v1_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(in *v1.NodeUnprepareResourceResponse, out *NodeUnprepareResourceResponse, s conversion.Scope) error { + return autoConvert_v1_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(in, out, s) +} + +func autoConvert_v1beta1_NodeUnprepareResourcesRequest_To_v1_NodeUnprepareResourcesRequest(in *NodeUnprepareResourcesRequest, out *v1.NodeUnprepareResourcesRequest, s conversion.Scope) error { + out.Claims = *(*[]*v1.Claim)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1_NodeUnprepareResourcesRequest is an autogenerated conversion function. +func Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1_NodeUnprepareResourcesRequest(in *NodeUnprepareResourcesRequest, out *v1.NodeUnprepareResourcesRequest, s conversion.Scope) error { + return autoConvert_v1beta1_NodeUnprepareResourcesRequest_To_v1_NodeUnprepareResourcesRequest(in, out, s) +} + +func autoConvert_v1_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(in *v1.NodeUnprepareResourcesRequest, out *NodeUnprepareResourcesRequest, s conversion.Scope) error { + out.Claims = *(*[]*Claim)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest is an autogenerated conversion function. +func Convert_v1_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(in *v1.NodeUnprepareResourcesRequest, out *NodeUnprepareResourcesRequest, s conversion.Scope) error { + return autoConvert_v1_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(in, out, s) +} + +func autoConvert_v1beta1_NodeUnprepareResourcesResponse_To_v1_NodeUnprepareResourcesResponse(in *NodeUnprepareResourcesResponse, out *v1.NodeUnprepareResourcesResponse, s conversion.Scope) error { + out.Claims = *(*map[string]*v1.NodeUnprepareResourceResponse)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1_NodeUnprepareResourcesResponse is an autogenerated conversion function. +func Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1_NodeUnprepareResourcesResponse(in *NodeUnprepareResourcesResponse, out *v1.NodeUnprepareResourcesResponse, s conversion.Scope) error { + return autoConvert_v1beta1_NodeUnprepareResourcesResponse_To_v1_NodeUnprepareResourcesResponse(in, out, s) +} + +func autoConvert_v1_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(in *v1.NodeUnprepareResourcesResponse, out *NodeUnprepareResourcesResponse, s conversion.Scope) error { + out.Claims = *(*map[string]*NodeUnprepareResourceResponse)(unsafe.Pointer(&in.Claims)) + out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral + out.XXX_sizecache = in.XXX_sizecache + return nil +} + +// Convert_v1_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse is an autogenerated conversion function. +func Convert_v1_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(in *v1.NodeUnprepareResourcesResponse, out *NodeUnprepareResourcesResponse, s conversion.Scope) error { + return autoConvert_v1_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(in, out, s) +} + +func autoConvert_v1beta1_UnimplementedDRAPluginServer_To_v1_UnimplementedDRAPluginServer(in *UnimplementedDRAPluginServer, out *v1.UnimplementedDRAPluginServer, s conversion.Scope) error { + return nil +} + +// Convert_v1beta1_UnimplementedDRAPluginServer_To_v1_UnimplementedDRAPluginServer is an autogenerated conversion function. +func Convert_v1beta1_UnimplementedDRAPluginServer_To_v1_UnimplementedDRAPluginServer(in *UnimplementedDRAPluginServer, out *v1.UnimplementedDRAPluginServer, s conversion.Scope) error { + return autoConvert_v1beta1_UnimplementedDRAPluginServer_To_v1_UnimplementedDRAPluginServer(in, out, s) +} + +func autoConvert_v1_UnimplementedDRAPluginServer_To_v1beta1_UnimplementedDRAPluginServer(in *v1.UnimplementedDRAPluginServer, out *UnimplementedDRAPluginServer, s conversion.Scope) error { + return nil +} + +// Convert_v1_UnimplementedDRAPluginServer_To_v1beta1_UnimplementedDRAPluginServer is an autogenerated conversion function. +func Convert_v1_UnimplementedDRAPluginServer_To_v1beta1_UnimplementedDRAPluginServer(in *v1.UnimplementedDRAPluginServer, out *UnimplementedDRAPluginServer, s conversion.Scope) error { + return autoConvert_v1_UnimplementedDRAPluginServer_To_v1beta1_UnimplementedDRAPluginServer(in, out, s) +} diff --git a/test/e2e/dra/dra.go b/test/e2e/dra/dra.go index 9a817db64e8..a0c8156d96e 100644 --- a/test/e2e/dra/dra.go +++ b/test/e2e/dra/dra.go @@ -87,10 +87,13 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), framework.With }) ginkgo.It("must retry NodePrepareResources", func(ctx context.Context) { - // We have exactly one host. - m := drautils.MethodInstance{NodeName: driver.Nodenames()[0], FullMethod: drautils.NodePrepareResourcesMethod} + // We have exactly one host. The API version depends on the kubelet + // we test with (version skew!), so we need to be a bit flexible. + mV1Beta1 := drautils.MethodInstance{NodeName: driver.Nodenames()[0], FullMethod: "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodePrepareResources"} + mV1 := drautils.MethodInstance{NodeName: driver.Nodenames()[0], FullMethod: "/k8s.io.kubelet.pkg.apis.dra.v1.DRAPlugin/NodePrepareResources"} - driver.Fail(m, true) + driver.Fail(mV1Beta1, true) + driver.Fail(mV1, true) ginkgo.By("waiting for container startup to fail") pod, template := b.PodInline() @@ -99,18 +102,19 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), framework.With ginkgo.By("wait for NodePrepareResources call") gomega.Eventually(ctx, func(ctx context.Context) error { - if driver.CallCount(m) == 0 { + if driver.CallCount(mV1Beta1)+driver.CallCount(mV1) == 0 { return errors.New("NodePrepareResources not called yet") } return nil }).WithTimeout(podStartTimeout).Should(gomega.Succeed()) ginkgo.By("allowing container startup to succeed") - callCount := driver.CallCount(m) - driver.Fail(m, false) + callCount := driver.CallCount(mV1Beta1) + driver.CallCount(mV1) + driver.Fail(mV1, false) + driver.Fail(mV1Beta1, false) err := e2epod.WaitForPodNameRunningInNamespace(ctx, f.ClientSet, pod.Name, pod.Namespace) framework.ExpectNoError(err, "start pod with inline resource claim") - if driver.CallCount(m) == callCount { + if driver.CallCount(mV1Beta1)+driver.CallCount(mV1) == callCount { framework.Fail("NodePrepareResources should have been called again") } }) @@ -302,7 +306,7 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), framework.With framework.ExpectNoError(f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(ctx, pod.Name, forceDelete)) // Fail NodeUnprepareResources to simulate long grace period - unprepareResources := drautils.MethodInstance{NodeName: node, FullMethod: drautils.NodeUnprepareResourcesMethod} + unprepareResources := drautils.MethodInstance{NodeName: node, FullMethod: "/k8s.io.kubelet.pkg.apis.dra.v1.DRAPlugin/NodeUnprepareResources"} driver.Fail(unprepareResources, true) // The pod should get deleted immediately. @@ -2548,14 +2552,16 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), framework.With }) }) - multipleDrivers := func(nodeV1beta1 bool) { + multipleDrivers := func(nodeV1beta1, nodeV1 bool) { nodes := drautils.NewNodes(f, 1, 4) driver1 := drautils.NewDriver(f, nodes, drautils.DriverResources(2)) driver1.NodeV1beta1 = nodeV1beta1 + driver1.NodeV1 = nodeV1 b1 := drautils.NewBuilder(f, driver1) driver2 := drautils.NewDriver(f, nodes, drautils.DriverResources(2)) driver2.NodeV1beta1 = nodeV1beta1 + driver2.NodeV1 = nodeV1 driver2.NameSuffix = "-other" b2 := drautils.NewBuilder(f, driver2) @@ -2578,14 +2584,26 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), framework.With b1.TestPod(ctx, f, pod) }) } - multipleDriversContext := func(prefix string, nodeV1beta1 bool) { - ginkgo.Context(prefix, func() { - multipleDrivers(nodeV1beta1) - }) + multipleDriversContext := func(prefix string, nodeV1beta1, nodeV1 bool) { + args := []any{ + prefix, + func() { + multipleDrivers(nodeV1beta1, nodeV1) + }, + } + if !nodeV1beta1 { + // If the v1beta1 gRPC API is disabled, then + // kubelet from 1.34 is required because that is + // when v1 was introduced. + args = append(args, f.WithLabel("KubeletMinVersion:1.34")) + } + framework.Context(args...) } framework.Context("kubelet", feature.DynamicResourceAllocation, "with multiple drivers", func() { - multipleDriversContext("using only drapbv1beta1", true) + multipleDriversContext("using only drapbv1beta1", true, false) + multipleDriversContext("using only drapbv1", false, true) + multipleDriversContext("using drapbv1beta1 and drapbv1", true, true) }) }) diff --git a/test/e2e/dra/utils/deploy.go b/test/e2e/dra/utils/deploy.go index 32324eb7042..06e01989f05 100644 --- a/test/e2e/dra/utils/deploy.go +++ b/test/e2e/dra/utils/deploy.go @@ -79,11 +79,6 @@ import ( "sigs.k8s.io/yaml" ) -const ( - NodePrepareResourcesMethod = "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodePrepareResources" - NodeUnprepareResourcesMethod = "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodeUnprepareResources" -) - type Nodes struct { NodeNames []string tempDir string @@ -290,9 +285,10 @@ func NewDriverInstance(f *framework.Framework) *Driver { f: f, fail: map[MethodInstance]bool{}, callCounts: map[MethodInstance]int64{}, - // By default, test only with the latest gRPC API. - NodeV1alpha4: false, - NodeV1beta1: true, + // By default, test with all gRPC APIs. + // TODO: should setting this be optional to test the actual helper defaults? + NodeV1: true, + NodeV1beta1: true, // By default, assume that the kubelet supports DRA and that // the driver's removal causes ResourceSlice cleanup. WithKubelet: true, @@ -355,8 +351,8 @@ type Driver struct { // /var/run/cdi are writable by the current user. IsLocal bool - NodeV1alpha4 bool - NodeV1beta1 bool + NodeV1 bool + NodeV1beta1 bool // Register the DRA test driver with the kubelet and expect DRA to work (= feature.DynamicResourceAllocation). WithKubelet bool @@ -603,6 +599,8 @@ func (d *Driver) SetUp(nodes *Nodes, driverResources map[string]resourceslice.Dr kubeletplugin.GRPCStreamInterceptor(func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error) { return d.streamInterceptor(nodename, srv, ss, info, handler) }), + kubeletplugin.NodeV1(d.NodeV1), + kubeletplugin.NodeV1beta1(d.NodeV1beta1), kubeletplugin.RollingUpdate(rollingUpdateUID), kubeletplugin.Serialize(serialize),