mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-10 17:48:25 +08:00
Merge branch 'NET-390-endpointdetection-config-fix' of https://github.com/gravitl/netmaker into NET-390-scale-latest
This commit is contained in:
commit
1a67b4e49b
5 changed files with 15 additions and 18 deletions
|
@ -177,7 +177,6 @@ func CreateHost(h *models.Host) error {
|
|||
}
|
||||
h.HostPass = string(hash)
|
||||
h.AutoUpdate = servercfg.AutoUpdateEnabled()
|
||||
h.EndpointDetection = servercfg.EndpointDetectionEnabled()
|
||||
// if another server has already updated proxyenabled, leave it alone
|
||||
if !h.ProxyEnabledSet {
|
||||
log.Println("checking default proxy", servercfg.GetServerConfig().DefaultProxyMode)
|
||||
|
|
|
@ -119,8 +119,7 @@ func GetPeerUpdateForHost(ctx context.Context, network string, host *models.Host
|
|||
}
|
||||
|
||||
// endpoint detection always comes from the server
|
||||
hostPeerUpdate.Host.EndpointDetection = servercfg.EndpointDetectionEnabled()
|
||||
|
||||
hostPeerUpdate.EndpointDetection = servercfg.EndpointDetectionEnabled()
|
||||
slog.Debug("peer update for host", "hostId", host.ID.String())
|
||||
peerIndexMap := make(map[string]int)
|
||||
for _, nodeID := range host.Nodes {
|
||||
|
|
|
@ -48,7 +48,6 @@ type Host struct {
|
|||
IPForwarding bool `json:"ipforwarding" yaml:"ipforwarding"`
|
||||
DaemonInstalled bool `json:"daemoninstalled" yaml:"daemoninstalled"`
|
||||
AutoUpdate bool `json:"autoupdate" yaml:"autoupdate"`
|
||||
EndpointDetection bool `json:"endpointdetection" yaml:"endpointdetection"`
|
||||
HostPass string `json:"hostpass" yaml:"hostpass"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
OS string `json:"os" yaml:"os"`
|
||||
|
|
|
@ -8,18 +8,19 @@ import (
|
|||
|
||||
// HostPeerUpdate - struct for host peer updates
|
||||
type HostPeerUpdate struct {
|
||||
Host Host `json:"host" bson:"host" yaml:"host"`
|
||||
Server string `json:"server" bson:"server" yaml:"server"`
|
||||
ServerVersion string `json:"serverversion" bson:"serverversion" yaml:"serverversion"`
|
||||
ServerAddrs []ServerAddr `json:"serveraddrs" bson:"serveraddrs" yaml:"serveraddrs"`
|
||||
NodePeers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
|
||||
Peers []wgtypes.PeerConfig
|
||||
HostPeerIDs HostPeerMap `json:"hostpeerids" bson:"hostpeerids" yaml:"hostpeerids"`
|
||||
ProxyUpdate ProxyManagerPayload `json:"proxy_update" bson:"proxy_update" yaml:"proxy_update"`
|
||||
EgressInfo map[string]EgressInfo `json:"egress_info" bson:"egress_info" yaml:"egress_info"` // map key is node ID
|
||||
IngressInfo IngressInfo `json:"ingress_info" bson:"ext_peers" yaml:"ext_peers"`
|
||||
PeerIDs PeerMap `json:"peerids" bson:"peerids" yaml:"peerids"`
|
||||
HostNetworkInfo HostInfoMap `json:"host_network_info,omitempty" bson:"host_network_info,omitempty" yaml:"host_network_info,omitempty"`
|
||||
Host Host `json:"host" bson:"host" yaml:"host"`
|
||||
Server string `json:"server" bson:"server" yaml:"server"`
|
||||
ServerVersion string `json:"serverversion" bson:"serverversion" yaml:"serverversion"`
|
||||
ServerAddrs []ServerAddr `json:"serveraddrs" bson:"serveraddrs" yaml:"serveraddrs"`
|
||||
NodePeers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
|
||||
Peers []wgtypes.PeerConfig
|
||||
HostPeerIDs HostPeerMap `json:"hostpeerids" bson:"hostpeerids" yaml:"hostpeerids"`
|
||||
ProxyUpdate ProxyManagerPayload `json:"proxy_update" bson:"proxy_update" yaml:"proxy_update"`
|
||||
EgressInfo map[string]EgressInfo `json:"egress_info" bson:"egress_info" yaml:"egress_info"` // map key is node ID
|
||||
IngressInfo IngressInfo `json:"ingress_info" bson:"ext_peers" yaml:"ext_peers"`
|
||||
PeerIDs PeerMap `json:"peerids" bson:"peerids" yaml:"peerids"`
|
||||
EndpointDetection bool `json:"endpointdetection" yaml:"endpointdetection"`
|
||||
HostNetworkInfo HostInfoMap `json:"host_network_info,omitempty" bson:"host_network_info,omitempty" yaml:"host_network_info,omitempty"`
|
||||
}
|
||||
|
||||
// IngressInfo - struct for ingress info
|
||||
|
|
|
@ -446,8 +446,7 @@ func handleHostCheckin(h, currentHost *models.Host) bool {
|
|||
ifaceDelta := len(h.Interfaces) != len(currentHost.Interfaces) ||
|
||||
!h.EndpointIP.Equal(currentHost.EndpointIP) ||
|
||||
(len(h.NatType) > 0 && h.NatType != currentHost.NatType) ||
|
||||
h.DefaultInterface != currentHost.DefaultInterface ||
|
||||
h.EndpointDetection != servercfg.EndpointDetectionEnabled()
|
||||
h.DefaultInterface != currentHost.DefaultInterface
|
||||
if ifaceDelta { // only save if something changes
|
||||
currentHost.EndpointIP = h.EndpointIP
|
||||
currentHost.Interfaces = h.Interfaces
|
||||
|
|
Loading…
Reference in a new issue