在集群中可以设置自动加入DNS的CNAME记录

This commit is contained in:
刘祥超
2021-09-20 16:37:48 +08:00
parent 7a1bd29f6f
commit d121bc86a0
5 changed files with 136 additions and 18 deletions

View File

@@ -436,7 +436,7 @@ func (this *NodeClusterDAO) ExistClusterDNSName(tx *dbs.Tx, dnsName string, excl
}
// UpdateClusterDNS 修改集群DNS相关信息
func (this *NodeClusterDAO) UpdateClusterDNS(tx *dbs.Tx, clusterId int64, dnsName string, dnsDomainId int64, nodesAutoSync bool, serversAutoSync bool) error {
func (this *NodeClusterDAO) UpdateClusterDNS(tx *dbs.Tx, clusterId int64, dnsName string, dnsDomainId int64, nodesAutoSync bool, serversAutoSync bool, cnameRecords []string) error {
if clusterId <= 0 {
return errors.New("invalid clusterId")
}
@@ -445,9 +445,14 @@ func (this *NodeClusterDAO) UpdateClusterDNS(tx *dbs.Tx, clusterId int64, dnsNam
op.DnsName = dnsName
op.DnsDomainId = dnsDomainId
if len(cnameRecords) == 0 {
cnameRecords = []string{}
}
dnsConfig := &dnsconfigs.ClusterDNSConfig{
NodesAutoSync: nodesAutoSync,
ServersAutoSync: serversAutoSync,
CNameRecords: cnameRecords,
}
dnsJSON, err := json.Marshal(dnsConfig)
if err != nil {