diff --git a/Makefile b/Makefile index 53e31ee..542544b 100644 --- a/Makefile +++ b/Makefile @@ -149,10 +149,10 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen GOLANGCILINT_VERSION ?= v1.62.2 GCOV2LCOV_VERSION ?= v1.0.5 MOCKERY_VERSION ?= v2.49.1 -PROTOC_VER ?= 23.4 -PROTOC_GEN_GO_VER ?= 1.31.0 -PROTOC_GEN_GO_GRPC_VER ?= 1.3.0 -BUF_VERSION ?= 1.23.1 +PROTOC_VER ?= 28.3 +PROTOC_GEN_GO_VER ?= 1.35.2 +PROTOC_GEN_GO_GRPC_VER ?= 1.5.1 +BUF_VERSION ?= 1.47.2 CONTROLLER_GEN_VERSION ?= v0.16.5 .PHONY: envtest @@ -249,7 +249,7 @@ grpc-check: grpc-format grpc-lint protoc protoc-gen-go protoc-gen-go-grpc $(GRPC grpc-lint: buf ## Lint GRPC files @echo "lint protobuf files"; cd $(PROTO_DIR) && \ - $(BUF) lint --config ../buf.yaml + $(BUF) lint --config ../buf.yaml . .PHONY: grpc-format grpc-format: buf ## Format GRPC files diff --git a/api/grpc/buf.yaml b/api/grpc/buf.yaml index ec75633..84a25d1 100644 --- a/api/grpc/buf.yaml +++ b/api/grpc/buf.yaml @@ -1,5 +1,5 @@ version: v1 lint: use: - - DEFAULT - - PACKAGE_NO_IMPORT_CYCLE + - STANDARD + - COMMENTS diff --git a/api/grpc/nvidia/ipam/node/v1/node.pb.go b/api/grpc/nvidia/ipam/node/v1/node.pb.go index 61f5466..a0e7f2c 100644 --- a/api/grpc/nvidia/ipam/node/v1/node.pb.go +++ b/api/grpc/nvidia/ipam/node/v1/node.pb.go @@ -11,8 +11,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc-gen-go v1.35.2 +// protoc v5.28.3 // source: nvidia/ipam/node/v1/node.proto package v1 @@ -35,9 +35,12 @@ const ( type PoolType int32 const ( + // the pool type is not specified PoolType_POOL_TYPE_UNSPECIFIED PoolType = 0 - PoolType_POOL_TYPE_IPPOOL PoolType = 1 - PoolType_POOL_TYPE_CIDRPOOL PoolType = 2 + // the pool type is IPPool + PoolType_POOL_TYPE_IPPOOL PoolType = 1 + // the pool type is CIDRPool + PoolType_POOL_TYPE_CIDRPOOL PoolType = 2 ) // Enum value maps for PoolType. @@ -93,11 +96,9 @@ type AllocateRequest struct { func (x *AllocateRequest) Reset() { *x = AllocateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AllocateRequest) String() string { @@ -108,7 +109,7 @@ func (*AllocateRequest) ProtoMessage() {} func (x *AllocateRequest) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -155,11 +156,9 @@ type IPAMParameters struct { func (x *IPAMParameters) Reset() { *x = IPAMParameters{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IPAMParameters) String() string { @@ -170,7 +169,7 @@ func (*IPAMParameters) ProtoMessage() {} func (x *IPAMParameters) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -252,11 +251,9 @@ type IPAMMetadata struct { func (x *IPAMMetadata) Reset() { *x = IPAMMetadata{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IPAMMetadata) String() string { @@ -267,7 +264,7 @@ func (*IPAMMetadata) ProtoMessage() {} func (x *IPAMMetadata) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -324,11 +321,9 @@ type IPAMFeatures struct { func (x *IPAMFeatures) Reset() { *x = IPAMFeatures{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IPAMFeatures) String() string { @@ -339,7 +334,7 @@ func (*IPAMFeatures) ProtoMessage() {} func (x *IPAMFeatures) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -380,11 +375,9 @@ type IsAllocatedRequest struct { func (x *IsAllocatedRequest) Reset() { *x = IsAllocatedRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IsAllocatedRequest) String() string { @@ -395,7 +388,7 @@ func (*IsAllocatedRequest) ProtoMessage() {} func (x *IsAllocatedRequest) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -429,11 +422,9 @@ type DeallocateRequest struct { func (x *DeallocateRequest) Reset() { *x = DeallocateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeallocateRequest) String() string { @@ -444,7 +435,7 @@ func (*DeallocateRequest) ProtoMessage() {} func (x *DeallocateRequest) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -478,11 +469,9 @@ type AllocateResponse struct { func (x *AllocateResponse) Reset() { *x = AllocateResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AllocateResponse) String() string { @@ -493,7 +482,7 @@ func (*AllocateResponse) ProtoMessage() {} func (x *AllocateResponse) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -535,11 +524,9 @@ type AllocationInfo struct { func (x *AllocationInfo) Reset() { *x = AllocationInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AllocationInfo) String() string { @@ -550,7 +537,7 @@ func (*AllocationInfo) ProtoMessage() {} func (x *AllocationInfo) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -600,6 +587,7 @@ func (x *AllocationInfo) GetRoutes() []*Route { return nil } +// Route contains route configuration for the allocation type Route struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -611,11 +599,9 @@ type Route struct { func (x *Route) Reset() { *x = Route{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Route) String() string { @@ -626,7 +612,7 @@ func (*Route) ProtoMessage() {} func (x *Route) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -657,11 +643,9 @@ type IsAllocatedResponse struct { func (x *IsAllocatedResponse) Reset() { *x = IsAllocatedResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *IsAllocatedResponse) String() string { @@ -672,7 +656,7 @@ func (*IsAllocatedResponse) ProtoMessage() {} func (x *IsAllocatedResponse) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -696,11 +680,9 @@ type DeallocateResponse struct { func (x *DeallocateResponse) Reset() { *x = DeallocateResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeallocateResponse) String() string { @@ -711,7 +693,7 @@ func (*DeallocateResponse) ProtoMessage() {} func (x *DeallocateResponse) ProtoReflect() protoreflect.Message { mi := &file_nvidia_ipam_node_v1_node_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -854,7 +836,7 @@ func file_nvidia_ipam_node_v1_node_proto_rawDescGZIP() []byte { var file_nvidia_ipam_node_v1_node_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_nvidia_ipam_node_v1_node_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_nvidia_ipam_node_v1_node_proto_goTypes = []interface{}{ +var file_nvidia_ipam_node_v1_node_proto_goTypes = []any{ (PoolType)(0), // 0: nvidia.ipam.node.v1.PoolType (*AllocateRequest)(nil), // 1: nvidia.ipam.node.v1.AllocateRequest (*IPAMParameters)(nil), // 2: nvidia.ipam.node.v1.IPAMParameters @@ -896,141 +878,7 @@ func file_nvidia_ipam_node_v1_node_proto_init() { if File_nvidia_ipam_node_v1_node_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_nvidia_ipam_node_v1_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllocateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IPAMParameters); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IPAMMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IPAMFeatures); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IsAllocatedRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeallocateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllocateResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllocationInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Route); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IsAllocatedResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeallocateResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_nvidia_ipam_node_v1_node_proto_msgTypes[3].OneofWrappers = []interface{}{} + file_nvidia_ipam_node_v1_node_proto_msgTypes[3].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/api/grpc/nvidia/ipam/node/v1/node_grpc.pb.go b/api/grpc/nvidia/ipam/node/v1/node_grpc.pb.go index 68f55ab..26441b0 100644 --- a/api/grpc/nvidia/ipam/node/v1/node_grpc.pb.go +++ b/api/grpc/nvidia/ipam/node/v1/node_grpc.pb.go @@ -11,8 +11,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.28.3 // source: nvidia/ipam/node/v1/node.proto package v1 @@ -26,8 +26,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( IPAMService_Allocate_FullMethodName = "/nvidia.ipam.node.v1.IPAMService/Allocate" @@ -38,6 +38,8 @@ const ( // IPAMServiceClient is the client API for IPAMService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// gRPC service definition for NVIDIA IPAM node daemon type IPAMServiceClient interface { // Allocate is called as a part of CMD_ADD flow. // Returns response with allocated IPs if allocation succeeds or an error in case of failure. @@ -83,8 +85,9 @@ func NewIPAMServiceClient(cc grpc.ClientConnInterface) IPAMServiceClient { } func (c *iPAMServiceClient) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AllocateResponse) - err := c.cc.Invoke(ctx, IPAMService_Allocate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, IPAMService_Allocate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -92,8 +95,9 @@ func (c *iPAMServiceClient) Allocate(ctx context.Context, in *AllocateRequest, o } func (c *iPAMServiceClient) IsAllocated(ctx context.Context, in *IsAllocatedRequest, opts ...grpc.CallOption) (*IsAllocatedResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(IsAllocatedResponse) - err := c.cc.Invoke(ctx, IPAMService_IsAllocated_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, IPAMService_IsAllocated_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -101,8 +105,9 @@ func (c *iPAMServiceClient) IsAllocated(ctx context.Context, in *IsAllocatedRequ } func (c *iPAMServiceClient) Deallocate(ctx context.Context, in *DeallocateRequest, opts ...grpc.CallOption) (*DeallocateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DeallocateResponse) - err := c.cc.Invoke(ctx, IPAMService_Deallocate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, IPAMService_Deallocate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -111,7 +116,9 @@ func (c *iPAMServiceClient) Deallocate(ctx context.Context, in *DeallocateReques // IPAMServiceServer is the server API for IPAMService service. // All implementations must embed UnimplementedIPAMServiceServer -// for forward compatibility +// for forward compatibility. +// +// gRPC service definition for NVIDIA IPAM node daemon type IPAMServiceServer interface { // Allocate is called as a part of CMD_ADD flow. // Returns response with allocated IPs if allocation succeeds or an error in case of failure. @@ -149,9 +156,12 @@ type IPAMServiceServer interface { mustEmbedUnimplementedIPAMServiceServer() } -// UnimplementedIPAMServiceServer must be embedded to have forward compatible implementations. -type UnimplementedIPAMServiceServer struct { -} +// UnimplementedIPAMServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedIPAMServiceServer struct{} func (UnimplementedIPAMServiceServer) Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented") @@ -163,6 +173,7 @@ func (UnimplementedIPAMServiceServer) Deallocate(context.Context, *DeallocateReq return nil, status.Errorf(codes.Unimplemented, "method Deallocate not implemented") } func (UnimplementedIPAMServiceServer) mustEmbedUnimplementedIPAMServiceServer() {} +func (UnimplementedIPAMServiceServer) testEmbeddedByValue() {} // UnsafeIPAMServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to IPAMServiceServer will @@ -172,6 +183,13 @@ type UnsafeIPAMServiceServer interface { } func RegisterIPAMServiceServer(s grpc.ServiceRegistrar, srv IPAMServiceServer) { + // If the following call pancis, it indicates UnimplementedIPAMServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&IPAMService_ServiceDesc, srv) } diff --git a/api/grpc/proto/nvidia/ipam/node/v1/node.proto b/api/grpc/proto/nvidia/ipam/node/v1/node.proto index 565c29d..b31aaf0 100644 --- a/api/grpc/proto/nvidia/ipam/node/v1/node.proto +++ b/api/grpc/proto/nvidia/ipam/node/v1/node.proto @@ -15,8 +15,11 @@ package nvidia.ipam.node.v1; // indicates type of the pool which is referred by the name enum PoolType { + // the pool type is not specified POOL_TYPE_UNSPECIFIED = 0; + // the pool type is IPPool POOL_TYPE_IPPOOL = 1; + // the pool type is CIDRPool POOL_TYPE_CIDRPOOL = 2; } @@ -131,6 +134,7 @@ message AllocationInfo { repeated Route routes = 5; } +// Route contains route configuration for the allocation message Route { // Static route destination in CIDR format string dest = 1;