From 7e16660cd6e873564bab9336dbde9f7f648e462c Mon Sep 17 00:00:00 2001 From: Yury Kulazhenkov Date: Fri, 9 Jun 2023 11:15:44 +0300 Subject: [PATCH] Add initial GRPC API for IPAM Daemon Signed-off-by: Yury Kulazhenkov --- api/grpc/nvidia/ipam/daemon/v1/daemon.pb.go | 633 ++++++++++++++++++ .../nvidia/ipam/daemon/v1/daemon_grpc.pb.go | 189 ++++++ .../proto/nvidia/ipam/daemon/v1/daemon.proto | 55 ++ 3 files changed, 877 insertions(+) create mode 100644 api/grpc/nvidia/ipam/daemon/v1/daemon.pb.go create mode 100644 api/grpc/nvidia/ipam/daemon/v1/daemon_grpc.pb.go create mode 100644 api/grpc/proto/nvidia/ipam/daemon/v1/daemon.proto diff --git a/api/grpc/nvidia/ipam/daemon/v1/daemon.pb.go b/api/grpc/nvidia/ipam/daemon/v1/daemon.pb.go new file mode 100644 index 0000000..027c9b0 --- /dev/null +++ b/api/grpc/nvidia/ipam/daemon/v1/daemon.pb.go @@ -0,0 +1,633 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v4.23.2 +// source: nvidia/ipam/daemon/v1/daemon.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// AllocateRequest contains parameters for Allocate rpc call +type AllocateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CniVersion string `protobuf:"bytes,1,opt,name=cni_version,json=cniVersion,proto3" json:"cni_version,omitempty"` + CniNetns string `protobuf:"bytes,2,opt,name=cni_netns,json=cniNetns,proto3" json:"cni_netns,omitempty"` + CniIfname string `protobuf:"bytes,3,opt,name=cni_ifname,json=cniIfname,proto3" json:"cni_ifname,omitempty"` + K8SPodName string `protobuf:"bytes,4,opt,name=k8s_pod_name,json=k8sPodName,proto3" json:"k8s_pod_name,omitempty"` + K8SPodNamespace string `protobuf:"bytes,5,opt,name=k8s_pod_namespace,json=k8sPodNamespace,proto3" json:"k8s_pod_namespace,omitempty"` + // exist in containerd >= 1.6 cr-io >= 0.3 + K8SPodUid string `protobuf:"bytes,6,opt,name=k8s_pod_uid,json=k8sPodUid,proto3" json:"k8s_pod_uid,omitempty"` + DeviceId string `protobuf:"bytes,7,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` +} + +func (x *AllocateRequest) Reset() { + *x = AllocateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AllocateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocateRequest) ProtoMessage() {} + +func (x *AllocateRequest) ProtoReflect() protoreflect.Message { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocateRequest.ProtoReflect.Descriptor instead. +func (*AllocateRequest) Descriptor() ([]byte, []int) { + return file_nvidia_ipam_daemon_v1_daemon_proto_rawDescGZIP(), []int{0} +} + +func (x *AllocateRequest) GetCniVersion() string { + if x != nil { + return x.CniVersion + } + return "" +} + +func (x *AllocateRequest) GetCniNetns() string { + if x != nil { + return x.CniNetns + } + return "" +} + +func (x *AllocateRequest) GetCniIfname() string { + if x != nil { + return x.CniIfname + } + return "" +} + +func (x *AllocateRequest) GetK8SPodName() string { + if x != nil { + return x.K8SPodName + } + return "" +} + +func (x *AllocateRequest) GetK8SPodNamespace() string { + if x != nil { + return x.K8SPodNamespace + } + return "" +} + +func (x *AllocateRequest) GetK8SPodUid() string { + if x != nil { + return x.K8SPodUid + } + return "" +} + +func (x *AllocateRequest) GetDeviceId() string { + if x != nil { + return x.DeviceId + } + return "" +} + +// AllocateReply contains reply for Allocate rpc call +type AllocateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AllocateResponse) Reset() { + *x = AllocateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AllocateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllocateResponse) ProtoMessage() {} + +func (x *AllocateResponse) ProtoReflect() protoreflect.Message { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllocateResponse.ProtoReflect.Descriptor instead. +func (*AllocateResponse) Descriptor() ([]byte, []int) { + return file_nvidia_ipam_daemon_v1_daemon_proto_rawDescGZIP(), []int{1} +} + +// IsAllocatedRequest contains parameters for IsAllocated rpc call +type IsAllocatedRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CniVersion string `protobuf:"bytes,1,opt,name=cni_version,json=cniVersion,proto3" json:"cni_version,omitempty"` + CniNetns string `protobuf:"bytes,2,opt,name=cni_netns,json=cniNetns,proto3" json:"cni_netns,omitempty"` + CniIfname string `protobuf:"bytes,3,opt,name=cni_ifname,json=cniIfname,proto3" json:"cni_ifname,omitempty"` + K8SPodName string `protobuf:"bytes,4,opt,name=k8s_pod_name,json=k8sPodName,proto3" json:"k8s_pod_name,omitempty"` + K8SPodNamespace string `protobuf:"bytes,5,opt,name=k8s_pod_namespace,json=k8sPodNamespace,proto3" json:"k8s_pod_namespace,omitempty"` + K8SPodUid string `protobuf:"bytes,6,opt,name=k8s_pod_uid,json=k8sPodUid,proto3" json:"k8s_pod_uid,omitempty"` + DeviceId string `protobuf:"bytes,7,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` +} + +func (x *IsAllocatedRequest) Reset() { + *x = IsAllocatedRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IsAllocatedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IsAllocatedRequest) ProtoMessage() {} + +func (x *IsAllocatedRequest) ProtoReflect() protoreflect.Message { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IsAllocatedRequest.ProtoReflect.Descriptor instead. +func (*IsAllocatedRequest) Descriptor() ([]byte, []int) { + return file_nvidia_ipam_daemon_v1_daemon_proto_rawDescGZIP(), []int{2} +} + +func (x *IsAllocatedRequest) GetCniVersion() string { + if x != nil { + return x.CniVersion + } + return "" +} + +func (x *IsAllocatedRequest) GetCniNetns() string { + if x != nil { + return x.CniNetns + } + return "" +} + +func (x *IsAllocatedRequest) GetCniIfname() string { + if x != nil { + return x.CniIfname + } + return "" +} + +func (x *IsAllocatedRequest) GetK8SPodName() string { + if x != nil { + return x.K8SPodName + } + return "" +} + +func (x *IsAllocatedRequest) GetK8SPodNamespace() string { + if x != nil { + return x.K8SPodNamespace + } + return "" +} + +func (x *IsAllocatedRequest) GetK8SPodUid() string { + if x != nil { + return x.K8SPodUid + } + return "" +} + +func (x *IsAllocatedRequest) GetDeviceId() string { + if x != nil { + return x.DeviceId + } + return "" +} + +// IsAllocatedReply contains reply for IsAllocated rpc call +type IsAllocatedResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *IsAllocatedResponse) Reset() { + *x = IsAllocatedResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IsAllocatedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IsAllocatedResponse) ProtoMessage() {} + +func (x *IsAllocatedResponse) ProtoReflect() protoreflect.Message { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IsAllocatedResponse.ProtoReflect.Descriptor instead. +func (*IsAllocatedResponse) Descriptor() ([]byte, []int) { + return file_nvidia_ipam_daemon_v1_daemon_proto_rawDescGZIP(), []int{3} +} + +// DeallocateRequest contains parameters for Deallocate rpc call +type DeallocateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CniVersion string `protobuf:"bytes,1,opt,name=cni_version,json=cniVersion,proto3" json:"cni_version,omitempty"` + CniNetns string `protobuf:"bytes,2,opt,name=cni_netns,json=cniNetns,proto3" json:"cni_netns,omitempty"` + CniIfname string `protobuf:"bytes,3,opt,name=cni_ifname,json=cniIfname,proto3" json:"cni_ifname,omitempty"` + K8SPodName string `protobuf:"bytes,4,opt,name=k8s_pod_name,json=k8sPodName,proto3" json:"k8s_pod_name,omitempty"` + K8SPodNamespace string `protobuf:"bytes,5,opt,name=k8s_pod_namespace,json=k8sPodNamespace,proto3" json:"k8s_pod_namespace,omitempty"` + K8SPodUid string `protobuf:"bytes,6,opt,name=k8s_pod_uid,json=k8sPodUid,proto3" json:"k8s_pod_uid,omitempty"` +} + +func (x *DeallocateRequest) Reset() { + *x = DeallocateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeallocateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeallocateRequest) ProtoMessage() {} + +func (x *DeallocateRequest) ProtoReflect() protoreflect.Message { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeallocateRequest.ProtoReflect.Descriptor instead. +func (*DeallocateRequest) Descriptor() ([]byte, []int) { + return file_nvidia_ipam_daemon_v1_daemon_proto_rawDescGZIP(), []int{4} +} + +func (x *DeallocateRequest) GetCniVersion() string { + if x != nil { + return x.CniVersion + } + return "" +} + +func (x *DeallocateRequest) GetCniNetns() string { + if x != nil { + return x.CniNetns + } + return "" +} + +func (x *DeallocateRequest) GetCniIfname() string { + if x != nil { + return x.CniIfname + } + return "" +} + +func (x *DeallocateRequest) GetK8SPodName() string { + if x != nil { + return x.K8SPodName + } + return "" +} + +func (x *DeallocateRequest) GetK8SPodNamespace() string { + if x != nil { + return x.K8SPodNamespace + } + return "" +} + +func (x *DeallocateRequest) GetK8SPodUid() string { + if x != nil { + return x.K8SPodUid + } + return "" +} + +// DeallocateReply contains reply for Deallocate rpc call +type DeallocateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeallocateResponse) Reset() { + *x = DeallocateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeallocateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeallocateResponse) ProtoMessage() {} + +func (x *DeallocateResponse) ProtoReflect() protoreflect.Message { + mi := &file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeallocateResponse.ProtoReflect.Descriptor instead. +func (*DeallocateResponse) Descriptor() ([]byte, []int) { + return file_nvidia_ipam_daemon_v1_daemon_proto_rawDescGZIP(), []int{5} +} + +var File_nvidia_ipam_daemon_v1_daemon_proto protoreflect.FileDescriptor + +var file_nvidia_ipam_daemon_v1_daemon_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x2f, 0x69, 0x70, 0x61, 0x6d, 0x2f, 0x64, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x2e, 0x69, 0x70, 0x61, + 0x6d, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x22, 0xf9, 0x01, 0x0a, 0x0f, + 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1f, 0x0a, 0x0b, 0x63, 0x6e, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6e, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6e, 0x69, 0x5f, 0x6e, 0x65, 0x74, 0x6e, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6e, 0x69, 0x4e, 0x65, 0x74, 0x6e, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x63, 0x6e, 0x69, 0x5f, 0x69, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x63, 0x6e, 0x69, 0x49, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0c, + 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x38, 0x73, 0x50, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, + 0x0a, 0x11, 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6b, 0x38, 0x73, 0x50, 0x6f, + 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6b, 0x38, + 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x75, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6b, 0x38, 0x73, 0x50, 0x6f, 0x64, 0x55, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x12, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xfc, 0x01, 0x0a, 0x12, + 0x49, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6e, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6e, 0x69, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6e, 0x69, 0x5f, 0x6e, 0x65, 0x74, 0x6e, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6e, 0x69, 0x4e, 0x65, 0x74, 0x6e, 0x73, + 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6e, 0x69, 0x5f, 0x69, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6e, 0x69, 0x49, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x20, 0x0a, 0x0c, 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x38, 0x73, 0x50, 0x6f, 0x64, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6b, 0x38, + 0x73, 0x50, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1e, 0x0a, + 0x0b, 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x75, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x6b, 0x38, 0x73, 0x50, 0x6f, 0x64, 0x55, 0x69, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x49, 0x73, + 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0xde, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6e, 0x69, 0x5f, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6e, + 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6e, 0x69, 0x5f, + 0x6e, 0x65, 0x74, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6e, 0x69, + 0x4e, 0x65, 0x74, 0x6e, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6e, 0x69, 0x5f, 0x69, 0x66, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6e, 0x69, 0x49, 0x66, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x38, 0x73, 0x50, + 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, + 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x6b, 0x38, 0x73, 0x50, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6b, 0x38, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x75, 0x69, + 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6b, 0x38, 0x73, 0x50, 0x6f, 0x64, 0x55, + 0x69, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc0, 0x02, 0x0a, 0x12, 0x49, 0x50, 0x41, + 0x4d, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x5d, 0x0a, 0x08, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x12, 0x26, 0x2e, 0x6e, 0x76, + 0x69, 0x64, 0x69, 0x61, 0x2e, 0x69, 0x70, 0x61, 0x6d, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x2e, 0x69, 0x70, 0x61, + 0x6d, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x66, + 0x0a, 0x0b, 0x49, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x29, 0x2e, + 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x2e, 0x69, 0x70, 0x61, 0x6d, 0x2e, 0x64, 0x61, 0x65, 0x6d, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6e, 0x76, 0x69, 0x64, 0x69, + 0x61, 0x2e, 0x69, 0x70, 0x61, 0x6d, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x49, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x0a, 0x44, 0x65, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x65, 0x12, 0x28, 0x2e, 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x2e, 0x69, 0x70, + 0x61, 0x6d, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, + 0x2e, 0x6e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x2e, 0x69, 0x70, 0x61, 0x6d, 0x2e, 0x64, 0x61, 0x65, + 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_nvidia_ipam_daemon_v1_daemon_proto_rawDescOnce sync.Once + file_nvidia_ipam_daemon_v1_daemon_proto_rawDescData = file_nvidia_ipam_daemon_v1_daemon_proto_rawDesc +) + +func file_nvidia_ipam_daemon_v1_daemon_proto_rawDescGZIP() []byte { + file_nvidia_ipam_daemon_v1_daemon_proto_rawDescOnce.Do(func() { + file_nvidia_ipam_daemon_v1_daemon_proto_rawDescData = protoimpl.X.CompressGZIP(file_nvidia_ipam_daemon_v1_daemon_proto_rawDescData) + }) + return file_nvidia_ipam_daemon_v1_daemon_proto_rawDescData +} + +var file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_nvidia_ipam_daemon_v1_daemon_proto_goTypes = []interface{}{ + (*AllocateRequest)(nil), // 0: nvidia.ipam.daemon.v1.AllocateRequest + (*AllocateResponse)(nil), // 1: nvidia.ipam.daemon.v1.AllocateResponse + (*IsAllocatedRequest)(nil), // 2: nvidia.ipam.daemon.v1.IsAllocatedRequest + (*IsAllocatedResponse)(nil), // 3: nvidia.ipam.daemon.v1.IsAllocatedResponse + (*DeallocateRequest)(nil), // 4: nvidia.ipam.daemon.v1.DeallocateRequest + (*DeallocateResponse)(nil), // 5: nvidia.ipam.daemon.v1.DeallocateResponse +} +var file_nvidia_ipam_daemon_v1_daemon_proto_depIdxs = []int32{ + 0, // 0: nvidia.ipam.daemon.v1.IPAMBackendService.Allocate:input_type -> nvidia.ipam.daemon.v1.AllocateRequest + 2, // 1: nvidia.ipam.daemon.v1.IPAMBackendService.IsAllocated:input_type -> nvidia.ipam.daemon.v1.IsAllocatedRequest + 4, // 2: nvidia.ipam.daemon.v1.IPAMBackendService.Deallocate:input_type -> nvidia.ipam.daemon.v1.DeallocateRequest + 1, // 3: nvidia.ipam.daemon.v1.IPAMBackendService.Allocate:output_type -> nvidia.ipam.daemon.v1.AllocateResponse + 3, // 4: nvidia.ipam.daemon.v1.IPAMBackendService.IsAllocated:output_type -> nvidia.ipam.daemon.v1.IsAllocatedResponse + 5, // 5: nvidia.ipam.daemon.v1.IPAMBackendService.Deallocate:output_type -> nvidia.ipam.daemon.v1.DeallocateResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_nvidia_ipam_daemon_v1_daemon_proto_init() } +func file_nvidia_ipam_daemon_v1_daemon_proto_init() { + if File_nvidia_ipam_daemon_v1_daemon_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_nvidia_ipam_daemon_v1_daemon_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_daemon_v1_daemon_proto_msgTypes[1].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_daemon_v1_daemon_proto_msgTypes[2].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_daemon_v1_daemon_proto_msgTypes[3].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_daemon_v1_daemon_proto_msgTypes[4].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_daemon_v1_daemon_proto_msgTypes[5].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 + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_nvidia_ipam_daemon_v1_daemon_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_nvidia_ipam_daemon_v1_daemon_proto_goTypes, + DependencyIndexes: file_nvidia_ipam_daemon_v1_daemon_proto_depIdxs, + MessageInfos: file_nvidia_ipam_daemon_v1_daemon_proto_msgTypes, + }.Build() + File_nvidia_ipam_daemon_v1_daemon_proto = out.File + file_nvidia_ipam_daemon_v1_daemon_proto_rawDesc = nil + file_nvidia_ipam_daemon_v1_daemon_proto_goTypes = nil + file_nvidia_ipam_daemon_v1_daemon_proto_depIdxs = nil +} diff --git a/api/grpc/nvidia/ipam/daemon/v1/daemon_grpc.pb.go b/api/grpc/nvidia/ipam/daemon/v1/daemon_grpc.pb.go new file mode 100644 index 0000000..923a6eb --- /dev/null +++ b/api/grpc/nvidia/ipam/daemon/v1/daemon_grpc.pb.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.23.2 +// source: nvidia/ipam/daemon/v1/daemon.proto + +package v1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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 + +const ( + IPAMBackendService_Allocate_FullMethodName = "/nvidia.ipam.daemon.v1.IPAMBackendService/Allocate" + IPAMBackendService_IsAllocated_FullMethodName = "/nvidia.ipam.daemon.v1.IPAMBackendService/IsAllocated" + IPAMBackendService_Deallocate_FullMethodName = "/nvidia.ipam.daemon.v1.IPAMBackendService/Deallocate" +) + +// IPAMBackendServiceClient is the client API for IPAMBackendService 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. +type IPAMBackendServiceClient interface { + // Allocate is called as a part of CMD_ADD flow + Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) + // IsAllocated is called as a part of CMD_CHECk flow + IsAllocated(ctx context.Context, in *IsAllocatedRequest, opts ...grpc.CallOption) (*IsAllocatedResponse, error) + // Deallocate is called as a part of CMD_DEL flow + Deallocate(ctx context.Context, in *DeallocateRequest, opts ...grpc.CallOption) (*DeallocateResponse, error) +} + +type iPAMBackendServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewIPAMBackendServiceClient(cc grpc.ClientConnInterface) IPAMBackendServiceClient { + return &iPAMBackendServiceClient{cc} +} + +func (c *iPAMBackendServiceClient) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) { + out := new(AllocateResponse) + err := c.cc.Invoke(ctx, IPAMBackendService_Allocate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iPAMBackendServiceClient) IsAllocated(ctx context.Context, in *IsAllocatedRequest, opts ...grpc.CallOption) (*IsAllocatedResponse, error) { + out := new(IsAllocatedResponse) + err := c.cc.Invoke(ctx, IPAMBackendService_IsAllocated_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iPAMBackendServiceClient) Deallocate(ctx context.Context, in *DeallocateRequest, opts ...grpc.CallOption) (*DeallocateResponse, error) { + out := new(DeallocateResponse) + err := c.cc.Invoke(ctx, IPAMBackendService_Deallocate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IPAMBackendServiceServer is the server API for IPAMBackendService service. +// All implementations must embed UnimplementedIPAMBackendServiceServer +// for forward compatibility +type IPAMBackendServiceServer interface { + // Allocate is called as a part of CMD_ADD flow + Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) + // IsAllocated is called as a part of CMD_CHECk flow + IsAllocated(context.Context, *IsAllocatedRequest) (*IsAllocatedResponse, error) + // Deallocate is called as a part of CMD_DEL flow + Deallocate(context.Context, *DeallocateRequest) (*DeallocateResponse, error) + mustEmbedUnimplementedIPAMBackendServiceServer() +} + +// UnimplementedIPAMBackendServiceServer must be embedded to have forward compatible implementations. +type UnimplementedIPAMBackendServiceServer struct { +} + +func (UnimplementedIPAMBackendServiceServer) Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented") +} +func (UnimplementedIPAMBackendServiceServer) IsAllocated(context.Context, *IsAllocatedRequest) (*IsAllocatedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IsAllocated not implemented") +} +func (UnimplementedIPAMBackendServiceServer) Deallocate(context.Context, *DeallocateRequest) (*DeallocateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deallocate not implemented") +} +func (UnimplementedIPAMBackendServiceServer) mustEmbedUnimplementedIPAMBackendServiceServer() {} + +// UnsafeIPAMBackendServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to IPAMBackendServiceServer will +// result in compilation errors. +type UnsafeIPAMBackendServiceServer interface { + mustEmbedUnimplementedIPAMBackendServiceServer() +} + +func RegisterIPAMBackendServiceServer(s grpc.ServiceRegistrar, srv IPAMBackendServiceServer) { + s.RegisterService(&IPAMBackendService_ServiceDesc, srv) +} + +func _IPAMBackendService_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AllocateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPAMBackendServiceServer).Allocate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IPAMBackendService_Allocate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPAMBackendServiceServer).Allocate(ctx, req.(*AllocateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IPAMBackendService_IsAllocated_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IsAllocatedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPAMBackendServiceServer).IsAllocated(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IPAMBackendService_IsAllocated_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPAMBackendServiceServer).IsAllocated(ctx, req.(*IsAllocatedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IPAMBackendService_Deallocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeallocateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPAMBackendServiceServer).Deallocate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IPAMBackendService_Deallocate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPAMBackendServiceServer).Deallocate(ctx, req.(*DeallocateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// IPAMBackendService_ServiceDesc is the grpc.ServiceDesc for IPAMBackendService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var IPAMBackendService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "nvidia.ipam.daemon.v1.IPAMBackendService", + HandlerType: (*IPAMBackendServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Allocate", + Handler: _IPAMBackendService_Allocate_Handler, + }, + { + MethodName: "IsAllocated", + Handler: _IPAMBackendService_IsAllocated_Handler, + }, + { + MethodName: "Deallocate", + Handler: _IPAMBackendService_Deallocate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nvidia/ipam/daemon/v1/daemon.proto", +} diff --git a/api/grpc/proto/nvidia/ipam/daemon/v1/daemon.proto b/api/grpc/proto/nvidia/ipam/daemon/v1/daemon.proto new file mode 100644 index 0000000..7ad1e6b --- /dev/null +++ b/api/grpc/proto/nvidia/ipam/daemon/v1/daemon.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; + +package nvidia.ipam.daemon.v1; + +// gRPC service definition for NVIDIA IPAM daemon +service IPAMBackendService { + // Allocate is called as a part of CMD_ADD flow + rpc Allocate(AllocateRequest) returns (AllocateResponse) {} + // IsAllocated is called as a part of CMD_CHECk flow + rpc IsAllocated(IsAllocatedRequest) returns (IsAllocatedResponse) {} + // Deallocate is called as a part of CMD_DEL flow + rpc Deallocate(DeallocateRequest) returns (DeallocateResponse) {} +} + +// AllocateRequest contains parameters for Allocate rpc call +message AllocateRequest { + string cni_version = 1; + string cni_netns = 2; + string cni_ifname = 3; + string k8s_pod_name = 4; + string k8s_pod_namespace = 5; + // exist in containerd >= 1.6 cr-io >= 0.3 + string k8s_pod_uid = 6; + string device_id = 7; +} + +// AllocateReply contains reply for Allocate rpc call +message AllocateResponse {} + +// IsAllocatedRequest contains parameters for IsAllocated rpc call +message IsAllocatedRequest { + string cni_version = 1; + string cni_netns = 2; + string cni_ifname = 3; + string k8s_pod_name = 4; + string k8s_pod_namespace = 5; + string k8s_pod_uid = 6; + string device_id = 7; +} + +// IsAllocatedReply contains reply for IsAllocated rpc call +message IsAllocatedResponse {} + +// DeallocateRequest contains parameters for Deallocate rpc call +message DeallocateRequest { + string cni_version = 1; + string cni_netns = 2; + string cni_ifname = 3; + string k8s_pod_name = 4; + string k8s_pod_namespace = 5; + string k8s_pod_uid = 6; +} + +// DeallocateReply contains reply for Deallocate rpc call +message DeallocateResponse {}