From 4145fbf2a11c334ac632fb05637f675bc24bf970 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 15 Oct 2024 15:50:47 +0800 Subject: [PATCH] enhance: Enable prefer node lables in resource group add prefer node labels in resource groups, so resource group will prefer to accept some node with given label. Signed-off-by: Wei Liu --- go-api/rgpb/rg.pb.go | 158 ++++++++++++++++++++++++++++++++----------- proto/rg.proto | 5 ++ 2 files changed, 123 insertions(+), 40 deletions(-) diff --git a/go-api/rgpb/rg.pb.go b/go-api/rgpb/rg.pb.go index f823e18..2f94d2e 100644 --- a/go-api/rgpb/rg.pb.go +++ b/go-api/rgpb/rg.pb.go @@ -114,6 +114,53 @@ func (x *ResourceGroupTransfer) GetResourceGroup() string { return "" } +type ResourceGroupNodeFilter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PreferNodeLabels []string `protobuf:"bytes,1,rep,name=prefer_node_labels,json=preferNodeLabels,proto3" json:"prefer_node_labels,omitempty"` // node in resource group must match node labels requirements +} + +func (x *ResourceGroupNodeFilter) Reset() { + *x = ResourceGroupNodeFilter{} + if protoimpl.UnsafeEnabled { + mi := &file_rg_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResourceGroupNodeFilter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceGroupNodeFilter) ProtoMessage() {} + +func (x *ResourceGroupNodeFilter) ProtoReflect() protoreflect.Message { + mi := &file_rg_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 ResourceGroupNodeFilter.ProtoReflect.Descriptor instead. +func (*ResourceGroupNodeFilter) Descriptor() ([]byte, []int) { + return file_rg_proto_rawDescGZIP(), []int{2} +} + +func (x *ResourceGroupNodeFilter) GetPreferNodeLabels() []string { + if x != nil { + return x.PreferNodeLabels + } + return nil +} + type ResourceGroupConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -123,12 +170,13 @@ type ResourceGroupConfig struct { Limits *ResourceGroupLimit `protobuf:"bytes,2,opt,name=limits,proto3" json:"limits,omitempty"` // limited node num in resource group, if node num is more than limits.nodeNum, it will be transfer to other resource group. TransferFrom []*ResourceGroupTransfer `protobuf:"bytes,3,rep,name=transfer_from,json=transferFrom,proto3" json:"transfer_from,omitempty"` // missing node should be transfer from given resource group at high priority in repeated list. TransferTo []*ResourceGroupTransfer `protobuf:"bytes,4,rep,name=transfer_to,json=transferTo,proto3" json:"transfer_to,omitempty"` // redundant node should be transfer to given resource group at high priority in repeated list. + NodeFilter *ResourceGroupNodeFilter `protobuf:"bytes,5,opt,name=node_filter,json=nodeFilter,proto3" json:"node_filter,omitempty"` // node in resource group must match node filters, otherwise node should be move out } func (x *ResourceGroupConfig) Reset() { *x = ResourceGroupConfig{} if protoimpl.UnsafeEnabled { - mi := &file_rg_proto_msgTypes[2] + mi := &file_rg_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -141,7 +189,7 @@ func (x *ResourceGroupConfig) String() string { func (*ResourceGroupConfig) ProtoMessage() {} func (x *ResourceGroupConfig) ProtoReflect() protoreflect.Message { - mi := &file_rg_proto_msgTypes[2] + mi := &file_rg_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -154,7 +202,7 @@ func (x *ResourceGroupConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use ResourceGroupConfig.ProtoReflect.Descriptor instead. func (*ResourceGroupConfig) Descriptor() ([]byte, []int) { - return file_rg_proto_rawDescGZIP(), []int{2} + return file_rg_proto_rawDescGZIP(), []int{3} } func (x *ResourceGroupConfig) GetRequests() *ResourceGroupLimit { @@ -185,6 +233,13 @@ func (x *ResourceGroupConfig) GetTransferTo() []*ResourceGroupTransfer { return nil } +func (x *ResourceGroupConfig) GetNodeFilter() *ResourceGroupNodeFilter { + if x != nil { + return x.NodeFilter + } + return nil +} + var File_rg_proto protoreflect.FileDescriptor var file_rg_proto_rawDesc = []byte{ @@ -196,34 +251,43 @@ var file_rg_proto_rawDesc = []byte{ 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0xa9, 0x02, 0x0a, - 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x47, 0x0a, 0x17, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x6f, 0x64, + 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x10, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0xf4, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3f, 0x0a, + 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, + 0x67, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x3b, + 0x0a, 0x06, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x67, + 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x52, 0x06, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x4b, 0x0a, 0x0d, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x65, 0x72, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x47, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x67, 0x2e, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, + 0x6f, 0x12, 0x49, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x06, 0x6c, 0x69, 0x6d, 0x69, - 0x74, 0x73, 0x12, 0x4b, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x66, - 0x72, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6d, 0x69, 0x6c, 0x76, - 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, - 0x72, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x46, 0x72, 0x6f, 0x6d, 0x12, - 0x47, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x0a, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x6f, 0x42, 0x70, 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x6d, - 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x42, 0x12, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69, 0x6c, - 0x76, 0x75, 0x73, 0x2d, 0x69, 0x6f, 0x2f, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2d, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x67, - 0x70, 0x62, 0xa0, 0x01, 0x01, 0xaa, 0x02, 0x12, 0x4d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x70, 0x0a, 0x0e, + 0x69, 0x6f, 0x2e, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x42, 0x12, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6d, 0x69, 0x6c, 0x76, 0x75, 0x73, 0x2d, 0x69, 0x6f, 0x2f, 0x6d, 0x69, 0x6c, 0x76, 0x75, + 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x32, 0x2f, 0x72, 0x67, 0x70, 0x62, 0xa0, 0x01, 0x01, 0xaa, 0x02, 0x12, 0x4d, 0x69, 0x6c, 0x76, + 0x75, 0x73, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -238,22 +302,24 @@ func file_rg_proto_rawDescGZIP() []byte { return file_rg_proto_rawDescData } -var file_rg_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_rg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_rg_proto_goTypes = []interface{}{ - (*ResourceGroupLimit)(nil), // 0: milvus.proto.rg.ResourceGroupLimit - (*ResourceGroupTransfer)(nil), // 1: milvus.proto.rg.ResourceGroupTransfer - (*ResourceGroupConfig)(nil), // 2: milvus.proto.rg.ResourceGroupConfig + (*ResourceGroupLimit)(nil), // 0: milvus.proto.rg.ResourceGroupLimit + (*ResourceGroupTransfer)(nil), // 1: milvus.proto.rg.ResourceGroupTransfer + (*ResourceGroupNodeFilter)(nil), // 2: milvus.proto.rg.ResourceGroupNodeFilter + (*ResourceGroupConfig)(nil), // 3: milvus.proto.rg.ResourceGroupConfig } var file_rg_proto_depIdxs = []int32{ 0, // 0: milvus.proto.rg.ResourceGroupConfig.requests:type_name -> milvus.proto.rg.ResourceGroupLimit 0, // 1: milvus.proto.rg.ResourceGroupConfig.limits:type_name -> milvus.proto.rg.ResourceGroupLimit 1, // 2: milvus.proto.rg.ResourceGroupConfig.transfer_from:type_name -> milvus.proto.rg.ResourceGroupTransfer 1, // 3: milvus.proto.rg.ResourceGroupConfig.transfer_to:type_name -> milvus.proto.rg.ResourceGroupTransfer - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 2, // 4: milvus.proto.rg.ResourceGroupConfig.node_filter:type_name -> milvus.proto.rg.ResourceGroupNodeFilter + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_rg_proto_init() } @@ -287,6 +353,18 @@ func file_rg_proto_init() { } } file_rg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResourceGroupNodeFilter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResourceGroupConfig); i { case 0: return &v.state @@ -305,7 +383,7 @@ func file_rg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_rg_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/rg.proto b/proto/rg.proto index 5aee428..aeb4fd1 100644 --- a/proto/rg.proto +++ b/proto/rg.proto @@ -19,10 +19,15 @@ message ResourceGroupTransfer { string resource_group = 1; // resource groups can be transfered with current resource group. // preserve for other option, such as weight, priority or affinity setup. } + +message ResourceGroupNodeFilter { + repeated string prefer_node_labels = 1; // node in resource group must match node labels requirements +} message ResourceGroupConfig { ResourceGroupLimit requests = 1; // requests node num in resource group, if node num is less than requests.nodeNum, it will be transfer from other resource group. ResourceGroupLimit limits = 2; // limited node num in resource group, if node num is more than limits.nodeNum, it will be transfer to other resource group. repeated ResourceGroupTransfer transfer_from = 3; // missing node should be transfer from given resource group at high priority in repeated list. repeated ResourceGroupTransfer transfer_to = 4; // redundant node should be transfer to given resource group at high priority in repeated list. + ResourceGroupNodeFilter node_filter = 5; // node in resource group must match node filters, otherwise node should be move out }