初步实现多集群共享节点

This commit is contained in:
GoEdgeLab
2021-07-31 22:23:16 +08:00
parent 5e494dd932
commit 6bf3924d63
6 changed files with 1077 additions and 894 deletions

View File

@@ -48,12 +48,13 @@ type Node struct {
IsActive bool `protobuf:"varint,16,opt,name=isActive,proto3" json:"isActive,omitempty"`
MaxCacheDiskCapacity *SizeCapacity `protobuf:"bytes,17,opt,name=maxCacheDiskCapacity,proto3" json:"maxCacheDiskCapacity,omitempty"`
MaxCacheMemoryCapacity *SizeCapacity `protobuf:"bytes,18,opt,name=maxCacheMemoryCapacity,proto3" json:"maxCacheMemoryCapacity,omitempty"`
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"`
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
Login *NodeLogin `protobuf:"bytes,33,opt,name=login,proto3" json:"login,omitempty"`
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
IpAddresses []*NodeIPAddress `protobuf:"bytes,35,rep,name=ipAddresses,proto3" json:"ipAddresses,omitempty"`
NodeGroup *NodeGroup `protobuf:"bytes,36,opt,name=nodeGroup,proto3" json:"nodeGroup,omitempty"`
NodeRegion *NodeRegion `protobuf:"bytes,37,opt,name=nodeRegion,proto3" json:"nodeRegion,omitempty"`
SecondaryNodeClusters []*NodeCluster `protobuf:"bytes,38,rep,name=secondaryNodeClusters,proto3" json:"secondaryNodeClusters,omitempty"` // 从集群
}
func (x *Node) Reset() {
@@ -256,6 +257,13 @@ func (x *Node) GetNodeRegion() *NodeRegion {
return nil
}
func (x *Node) GetSecondaryNodeClusters() []*NodeCluster {
if x != nil {
return x.SecondaryNodeClusters
}
return nil
}
var File_models_model_node_proto protoreflect.FileDescriptor
var file_models_model_node_proto_rawDesc = []byte{
@@ -277,7 +285,7 @@ var file_models_model_node_proto_rawDesc = []byte{
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69,
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x07, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcc, 0x07, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a,
@@ -334,7 +342,12 @@ var file_models_model_node_proto_rawDesc = []byte{
0x12, 0x2e, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x25,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65,
0x67, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x45, 0x0a, 0x15, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64,
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x52, 0x15, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x43,
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -371,11 +384,12 @@ var file_models_model_node_proto_depIdxs = []int32{
6, // 6: pb.Node.ipAddresses:type_name -> pb.NodeIPAddress
7, // 7: pb.Node.nodeGroup:type_name -> pb.NodeGroup
8, // 8: pb.Node.nodeRegion:type_name -> pb.NodeRegion
9, // [9:9] is the sub-list for method output_type
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
3, // 9: pb.Node.secondaryNodeClusters:type_name -> pb.NodeCluster
10, // [10:10] is the sub-list for method output_type
10, // [10:10] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_models_model_node_proto_init() }

View File

@@ -41,6 +41,7 @@ type NodeCluster struct {
DnsDomainId int64 `protobuf:"varint,9,opt,name=dnsDomainId,proto3" json:"dnsDomainId,omitempty"`
HttpCachePolicyId int64 `protobuf:"varint,10,opt,name=httpCachePolicyId,proto3" json:"httpCachePolicyId,omitempty"`
HttpFirewallPolicyId int64 `protobuf:"varint,11,opt,name=httpFirewallPolicyId,proto3" json:"httpFirewallPolicyId,omitempty"`
IsOn bool `protobuf:"varint,12,opt,name=isOn,proto3" json:"isOn,omitempty"`
}
func (x *NodeCluster) Reset() {
@@ -152,12 +153,19 @@ func (x *NodeCluster) GetHttpFirewallPolicyId() int64 {
return 0
}
func (x *NodeCluster) GetIsOn() bool {
if x != nil {
return x.IsOn
}
return false
}
var File_models_model_node_cluster_proto protoreflect.FileDescriptor
var file_models_model_node_cluster_proto_rawDesc = []byte{
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xe3, 0x02, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xf7, 0x02, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65,
@@ -179,8 +187,9 @@ var file_models_model_node_cluster_proto_rawDesc = []byte{
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x14, 0x68, 0x74, 0x74, 0x70, 0x46,
0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18,
0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x68, 0x74, 0x74, 0x70, 0x46, 0x69, 0x72, 0x65, 0x77,
0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69,
0x73, 0x4f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

View File

@@ -32,10 +32,11 @@ message Node {
SizeCapacity maxCacheDiskCapacity = 17;
SizeCapacity maxCacheMemoryCapacity = 18;
NodeCluster nodeCluster = 32;
NodeCluster nodeCluster = 32; // 主集群
NodeLogin login = 33;
NodeInstallStatus installStatus = 34;
repeated NodeIPAddress ipAddresses = 35;
NodeGroup nodeGroup = 36;
NodeRegion nodeRegion = 37;
repeated NodeCluster secondaryNodeClusters = 38; // 从集群
}

View File

@@ -15,4 +15,5 @@ message NodeCluster {
int64 dnsDomainId = 9;
int64 httpCachePolicyId = 10;
int64 httpFirewallPolicyId = 11;
bool isOn = 12;
}

View File

@@ -32,6 +32,9 @@ service NodeService {
// 删除节点
rpc deleteNode (DeleteNodeRequest) returns (RPCSuccess);
// 从集群中删除节点
rpc deleteNodeFromNodeCluster (DeleteNodeFromNodeClusterRequest) returns (RPCSuccess);
// 修改节点
rpc updateNode (UpdateNodeRequest) returns (RPCSuccess);
@@ -126,7 +129,7 @@ message CreateNodeRequest {
int64 nodeClusterId = 2;
NodeLogin nodeLogin = 3;
int64 nodeGroupId = 4;
int64 dnsDomainId = 5;
int64 dnsDomainId = 5 [deprecated = true];
repeated string dnsRoutes = 6;
int64 nodeRegionId = 7;
}
@@ -190,16 +193,23 @@ message DeleteNodeRequest {
int64 nodeId = 1;
}
// 从集群中删除节点
message DeleteNodeFromNodeClusterRequest {
int64 nodeId = 1;
int64 nodeClusterId = 2;
}
// 修改节点
message UpdateNodeRequest {
int64 nodeId = 1;
string name = 2;
int64 nodeClusterId = 3;
repeated int64 secondaryNodeClusterIds = 13;
NodeLogin nodeLogin = 4;
int32 maxCPU = 5;
bool isOn = 6;
int64 nodeGroupId = 7;
int64 dnsDomainId = 8;
int64 dnsDomainId = 8 [deprecated = true];
repeated string dnsRoutes = 9;
int64 nodeRegionId = 10;
SizeCapacity maxCacheDiskCapacity = 11;
@@ -394,6 +404,7 @@ message NodeDNSInfo {
// 查找单个节点的域名解析信息
message FindEnabledNodeDNSRequest {
int64 nodeId = 1;
int64 nodeClusterId = 2;
}
message FindEnabledNodeDNSResponse {