可以设置集群的DNS记录TTL

This commit is contained in:
GoEdgeLab
2021-09-20 20:01:21 +08:00
parent d1351f63d6
commit c0dc9da023
14 changed files with 113 additions and 16 deletions

View File

@@ -404,10 +404,14 @@ func (this *DNSDomainService) findClusterDNSChanges(cluster *models.NodeCluster,
// 自动设置的cname记录
var cnameRecords = []string{}
var ttl int32
if len(cluster.Dns) > 0 {
dnsConfig, _ := cluster.DecodeDNSConfig()
if dnsConfig != nil {
cnameRecords = dnsConfig.CNameRecords
if dnsConfig.TTL > 0 {
ttl = dnsConfig.TTL
}
}
}
@@ -473,6 +477,7 @@ func (this *DNSDomainService) findClusterDNSChanges(cluster *models.NodeCluster,
Type: recordType,
Value: ip,
Route: route,
TTL: ttl,
},
})
nodesChanged = true
@@ -529,6 +534,7 @@ func (this *DNSDomainService) findClusterDNSChanges(cluster *models.NodeCluster,
Type: dnstypes.RecordTypeCNAME,
Value: clusterDomain + ".",
Route: "", // 注意这里为空,需要在执行过程中获取默认值
TTL: ttl,
},
})
} else {
@@ -550,6 +556,7 @@ func (this *DNSDomainService) findClusterDNSChanges(cluster *models.NodeCluster,
Type: dnstypes.RecordTypeCNAME,
Value: clusterDomain + ".",
Route: "", // 注意这里为空,需要在执行过程中获取默认值
TTL: ttl,
},
})
} else {