mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-10 20:40:56 +08:00
节点根据健康检查自动上下线
This commit is contained in:
@@ -1 +1,23 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs"
|
||||
)
|
||||
|
||||
// 解析DNS配置
|
||||
func (this *NodeCluster) DecodeDNSConfig() (*dnsconfigs.ClusterDNSConfig, error) {
|
||||
if len(this.Dns) == 0 || this.Dns == "null" {
|
||||
// 一定要返回一个默认的值,防止产生nil
|
||||
return &dnsconfigs.ClusterDNSConfig{
|
||||
NodesAutoSync: false,
|
||||
ServersAutoSync: false,
|
||||
}, nil
|
||||
}
|
||||
dnsConfig := &dnsconfigs.ClusterDNSConfig{}
|
||||
err := json.Unmarshal([]byte(this.Dns), &dnsConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dnsConfig, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user