集群DNS设置中增加”包含Ln节点“选项

This commit is contained in:
GoEdgeLab
2022-08-25 19:18:34 +08:00
parent 8cd0195cbc
commit 58dfbceb1e
6 changed files with 107 additions and 65 deletions

View File

@@ -25,7 +25,8 @@ func (this *DetailAction) Init() {
}
func (this *DetailAction) RunGet(params struct {
NodeId int64
NodeId int64
ClusterId int64
}) {
this.Data["nodeId"] = params.NodeId
@@ -43,13 +44,13 @@ func (this *DetailAction) RunGet(params struct {
// 主集群
var clusterMap maps.Map = nil
if node.NodeCluster != nil {
clusterId := node.NodeCluster.Id
var clusterId = node.NodeCluster.Id
clusterResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeCluster(this.AdminContext(), &pb.FindEnabledNodeClusterRequest{NodeClusterId: clusterId})
if err != nil {
this.ErrorPage(err)
return
}
cluster := clusterResp.NodeCluster
var cluster = clusterResp.NodeCluster
if cluster != nil {
clusterMap = maps.Map{
"id": cluster.Id,
@@ -69,6 +70,14 @@ func (this *DetailAction) RunGet(params struct {
})
}
// 当前访问集群的DNS设置
clusterDNSInfo, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId})
if err != nil {
this.ErrorPage(err)
return
}
this.Data["dnsIsExcludingLnNode"] = clusterDNSInfo != nil && !clusterDNSInfo.IncludingLnNodes && node.Level > 1
// IP地址
ipAddressesResp, err := this.RPC().NodeIPAddressRPC().FindAllEnabledNodeIPAddressesWithNodeId(this.AdminContext(), &pb.FindAllEnabledNodeIPAddressesWithNodeIdRequest{
NodeId: params.NodeId,

View File

@@ -53,6 +53,7 @@ func (this *IndexAction) RunGet(params struct {
}
this.Data["ttl"] = dnsInfoResp.Ttl
this.Data["cnameAsDomain"] = dnsInfoResp.CnameAsDomain
this.Data["includingLnNodes"] = dnsInfoResp.IncludingLnNodes
this.Show()
}
@@ -60,13 +61,14 @@ func (this *IndexAction) RunGet(params struct {
func (this *IndexAction) RunPost(params struct {
ClusterId int64
DnsDomainId int64
DnsName string
NodesAutoSync bool
ServersAutoSync bool
CnameRecords []string
Ttl int32
CnameAsDomain bool
DnsDomainId int64
DnsName string
NodesAutoSync bool
ServersAutoSync bool
CnameRecords []string
Ttl int32
CnameAsDomain bool
IncludingLnNodes bool
ConfirmResetDomain bool // 是否确认重置域名
@@ -107,14 +109,15 @@ func (this *IndexAction) RunPost(params struct {
}
_, err := this.RPC().NodeClusterRPC().UpdateNodeClusterDNS(this.AdminContext(), &pb.UpdateNodeClusterDNSRequest{
NodeClusterId: params.ClusterId,
DnsName: params.DnsName,
DnsDomainId: params.DnsDomainId,
NodesAutoSync: params.NodesAutoSync,
ServersAutoSync: params.ServersAutoSync,
CnameRecords: params.CnameRecords,
Ttl: params.Ttl,
CnameAsDomain: params.CnameAsDomain,
NodeClusterId: params.ClusterId,
DnsName: params.DnsName,
DnsDomainId: params.DnsDomainId,
NodesAutoSync: params.NodesAutoSync,
ServersAutoSync: params.ServersAutoSync,
CnameRecords: params.CnameRecords,
Ttl: params.Ttl,
CnameAsDomain: params.CnameAsDomain,
IncludingLnNodes: params.IncludingLnNodes,
})
if err != nil {
this.ErrorPage(err)