Skip to content

Commit 5ae7473

Browse files
authored
Merge pull request #3293 from gravitl/release-v0.30.0
Release v0.30.0
2 parents c524ef3 + 26300dc commit 5ae7473

File tree

3 files changed

+46
-19
lines changed

3 files changed

+46
-19
lines changed

pro/logic/status.go

+30-17
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ func getNodeStatusOld(node *models.Node) {
2626

2727
func GetNodeStatus(node *models.Node, defaultEnabledPolicy bool) {
2828

29-
if time.Since(node.LastCheckIn) > models.LastCheckInThreshold {
30-
node.Status = models.OfflineSt
31-
return
32-
}
3329
if node.IsStatic {
3430
if !node.StaticNode.Enabled {
3531
node.Status = models.OfflineSt
@@ -53,6 +49,10 @@ func GetNodeStatus(node *models.Node, defaultEnabledPolicy bool) {
5349
node.Status = models.UnKnown
5450
return
5551
}
52+
if time.Since(node.LastCheckIn) > models.LastCheckInThreshold {
53+
node.Status = models.OfflineSt
54+
return
55+
}
5656
host, err := logic.GetHost(node.HostID.String())
5757
if err != nil {
5858
node.Status = models.UnKnown
@@ -71,11 +71,15 @@ func GetNodeStatus(node *models.Node, defaultEnabledPolicy bool) {
7171
if err != nil {
7272
return
7373
}
74-
if metrics == nil || metrics.Connectivity == nil {
74+
if metrics == nil || metrics.Connectivity == nil || len(metrics.Connectivity) == 0 {
7575
if time.Since(node.LastCheckIn) < models.LastCheckInThreshold {
7676
node.Status = models.OnlineSt
7777
return
7878
}
79+
if node.LastCheckIn.IsZero() {
80+
node.Status = models.OfflineSt
81+
return
82+
}
7983
}
8084
// if node.IsFailOver {
8185
// if time.Since(node.LastCheckIn) < models.LastCheckInThreshold {
@@ -133,9 +137,12 @@ func checkPeerStatus(node *models.Node, defaultAclPolicy bool) {
133137
if err != nil {
134138
continue
135139
}
136-
allowed, _ := logic.IsNodeAllowedToCommunicate(*node, peer, false)
137-
if !defaultAclPolicy && !allowed {
138-
continue
140+
141+
if !defaultAclPolicy {
142+
allowed, _ := logic.IsNodeAllowedToCommunicate(*node, peer, false)
143+
if !allowed {
144+
continue
145+
}
139146
}
140147

141148
if time.Since(peer.LastCheckIn) > models.LastCheckInThreshold {
@@ -154,7 +161,7 @@ func checkPeerStatus(node *models.Node, defaultAclPolicy bool) {
154161
node.Status = models.OnlineSt
155162
return
156163
}
157-
if peerNotConnectedCnt == len(metrics.Connectivity) {
164+
if len(metrics.Connectivity) > 0 && peerNotConnectedCnt == len(metrics.Connectivity) {
158165
node.Status = models.ErrorSt
159166
return
160167
}
@@ -168,9 +175,12 @@ func checkPeerConnectivity(node *models.Node, metrics *models.Metrics, defaultAc
168175
if err != nil {
169176
continue
170177
}
171-
allowed, _ := logic.IsNodeAllowedToCommunicate(*node, peer, false)
172-
if !defaultAclPolicy && !allowed {
173-
continue
178+
179+
if !defaultAclPolicy {
180+
allowed, _ := logic.IsNodeAllowedToCommunicate(*node, peer, false)
181+
if !allowed {
182+
continue
183+
}
174184
}
175185

176186
if time.Since(peer.LastCheckIn) > models.LastCheckInThreshold {
@@ -181,19 +191,22 @@ func checkPeerConnectivity(node *models.Node, metrics *models.Metrics, defaultAc
181191
}
182192
// check if peer is in error state
183193
checkPeerStatus(&peer, defaultAclPolicy)
184-
if peer.Status == models.ErrorSt {
194+
if peer.Status == models.ErrorSt || peer.Status == models.WarningSt {
185195
continue
186196
}
187197
peerNotConnectedCnt++
188198

189199
}
190-
if peerNotConnectedCnt == 0 {
191-
node.Status = models.OnlineSt
200+
if peerNotConnectedCnt > len(metrics.Connectivity)/2 {
201+
node.Status = models.WarningSt
192202
return
193203
}
194-
if peerNotConnectedCnt == len(metrics.Connectivity) {
204+
205+
if len(metrics.Connectivity) > 0 && peerNotConnectedCnt == len(metrics.Connectivity) {
195206
node.Status = models.ErrorSt
196207
return
197208
}
198-
node.Status = models.WarningSt
209+
210+
node.Status = models.OnlineSt
211+
199212
}

scripts/nm-quick.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,7 @@ install_netmaker() {
617617

618618
echo "Pulling config files..."
619619

620-
621-
local BASE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG"
620+
local BASE_URL="https://raw.githubusercontent.com/gravitl/netmaker/master"
622621
local COMPOSE_URL="$BASE_URL/compose/docker-compose.yml"
623622
local CADDY_URL="$BASE_URL/docker/Caddyfile"
624623
if [ "$INSTALL_TYPE" = "pro" ]; then

servercfg/serverconf.go

+15
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,21 @@ func GetMqUserName() string {
654654
return password
655655
}
656656

657+
// GetMetricInterval - get the publish metric interval
658+
func GetMetricIntervalInMinutes() time.Duration {
659+
//default 15 minutes
660+
mi := "15"
661+
if os.Getenv("PUBLISH_METRIC_INTERVAL") != "" {
662+
mi = os.Getenv("PUBLISH_METRIC_INTERVAL")
663+
}
664+
interval, err := strconv.Atoi(mi)
665+
if err != nil {
666+
interval = 15
667+
}
668+
669+
return time.Duration(interval) * time.Minute
670+
}
671+
657672
// GetMetricInterval - get the publish metric interval
658673
func GetMetricInterval() string {
659674
//default 15 minutes

0 commit comments

Comments
 (0)