mirror of
https://github.com/gravitl/netmaker.git
synced 2026-04-22 16:07:11 +08:00
NM-311: Remove support for the -V installer flag in scripts/nm-quick.sh.
The script now always uses the default LATEST/BRANCH values and no longer accepts user-specified release overrides.
This commit is contained in:
+20
-9
@@ -424,21 +424,32 @@ func GetMetricIntervalInMinutes() time.Duration {
|
|||||||
return servercfg.GetMetricIntervalInMinutes()
|
return servercfg.GetMetricIntervalInMinutes()
|
||||||
}
|
}
|
||||||
|
|
||||||
var metricExportIntervalReset = make(chan struct{}, 1)
|
var (
|
||||||
|
metricExportIntervalMu sync.Mutex
|
||||||
|
metricExportIntervalSubs []chan struct{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// SubscribeMetricExportIntervalReset returns a channel notified when the metric interval setting changes.
|
||||||
|
func SubscribeMetricExportIntervalReset() <-chan struct{} {
|
||||||
|
ch := make(chan struct{}, 1)
|
||||||
|
metricExportIntervalMu.Lock()
|
||||||
|
metricExportIntervalSubs = append(metricExportIntervalSubs, ch)
|
||||||
|
metricExportIntervalMu.Unlock()
|
||||||
|
return ch
|
||||||
|
}
|
||||||
|
|
||||||
// NotifyMetricExportIntervalChanged signals mq.Keepalive to reset the metrics export ticker.
|
// NotifyMetricExportIntervalChanged signals mq.Keepalive to reset the metrics export ticker.
|
||||||
func NotifyMetricExportIntervalChanged() {
|
func NotifyMetricExportIntervalChanged() {
|
||||||
select {
|
metricExportIntervalMu.Lock()
|
||||||
case metricExportIntervalReset <- struct{}{}:
|
defer metricExportIntervalMu.Unlock()
|
||||||
default:
|
for _, ch := range metricExportIntervalSubs {
|
||||||
|
select {
|
||||||
|
case ch <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MetricExportIntervalReset returns a channel notified when the metric interval setting changes.
|
|
||||||
func MetricExportIntervalReset() <-chan struct{} {
|
|
||||||
return metricExportIntervalReset
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetMetricInterval - get the publish metric interval
|
// GetMetricInterval - get the publish metric interval
|
||||||
func GetMetricInterval() string {
|
func GetMetricInterval() string {
|
||||||
return GetServerSettings().MetricInterval
|
return GetServerSettings().MetricInterval
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ func Keepalive(ctx context.Context) {
|
|||||||
warmPeerCaches()
|
warmPeerCaches()
|
||||||
StartPeerUpdateWorker(ctx)
|
StartPeerUpdateWorker(ctx)
|
||||||
go PublishPeerUpdate(true)
|
go PublishPeerUpdate(true)
|
||||||
|
metricIntervalReset := logic.SubscribeMetricExportIntervalReset()
|
||||||
metricsTicker := time.NewTicker(normalizedMetricsExportInterval())
|
metricsTicker := time.NewTicker(normalizedMetricsExportInterval())
|
||||||
defer metricsTicker.Stop()
|
defer metricsTicker.Stop()
|
||||||
if servercfg.CacheEnabled() {
|
if servercfg.CacheEnabled() {
|
||||||
@@ -166,7 +167,7 @@ func Keepalive(ctx context.Context) {
|
|||||||
logic.FlushNodeCheckins()
|
logic.FlushNodeCheckins()
|
||||||
case <-metricsTicker.C:
|
case <-metricsTicker.C:
|
||||||
PushAllMetricsToExporter()
|
PushAllMetricsToExporter()
|
||||||
case <-logic.MetricExportIntervalReset():
|
case <-metricIntervalReset:
|
||||||
metricsTicker.Stop()
|
metricsTicker.Stop()
|
||||||
metricsTicker = time.NewTicker(normalizedMetricsExportInterval())
|
metricsTicker = time.NewTicker(normalizedMetricsExportInterval())
|
||||||
}
|
}
|
||||||
@@ -180,7 +181,7 @@ func Keepalive(ctx context.Context) {
|
|||||||
sendPeers()
|
sendPeers()
|
||||||
case <-metricsTicker.C:
|
case <-metricsTicker.C:
|
||||||
PushAllMetricsToExporter()
|
PushAllMetricsToExporter()
|
||||||
case <-logic.MetricExportIntervalReset():
|
case <-metricIntervalReset:
|
||||||
metricsTicker.Stop()
|
metricsTicker.Stop()
|
||||||
metricsTicker = time.NewTicker(normalizedMetricsExportInterval())
|
metricsTicker = time.NewTicker(normalizedMetricsExportInterval())
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -58,8 +58,11 @@ func handleServerSync(_ mqtt.Client, msg mqtt.Message) {
|
|||||||
|
|
||||||
switch syncMsg.SyncType {
|
switch syncMsg.SyncType {
|
||||||
case logic.SyncTypeSettings:
|
case logic.SyncTypeSettings:
|
||||||
|
oldInterval := logic.GetMetricInterval()
|
||||||
logic.InvalidateServerSettingsCache()
|
logic.InvalidateServerSettingsCache()
|
||||||
logic.NotifyMetricExportIntervalChanged()
|
if logic.GetMetricInterval() != oldInterval {
|
||||||
|
logic.NotifyMetricExportIntervalChanged()
|
||||||
|
}
|
||||||
case logic.SyncTypePeerUpdate:
|
case logic.SyncTypePeerUpdate:
|
||||||
logic.InvalidateHostPeerCaches()
|
logic.InvalidateHostPeerCaches()
|
||||||
go warmPeerCaches()
|
go warmPeerCaches()
|
||||||
|
|||||||
+2
-17
@@ -46,7 +46,6 @@ usage() {
|
|||||||
echo " with an existing install, -m alone only adds monitoring; use -p -m for a full Pro+monitoring re-install"
|
echo " with an existing install, -m alone only adds monitoring; use -p -m for a full Pro+monitoring re-install"
|
||||||
echo " -u if specified, will upgrade netmaker to pro version"
|
echo " -u if specified, will upgrade netmaker to pro version"
|
||||||
echo " -d if specified, will downgrade netmaker to community version"
|
echo " -d if specified, will downgrade netmaker to community version"
|
||||||
echo " -V <version> install a specific Netmaker release (e.g. v1.5.1 or 1.5.1); sets assets to branch release-<version>"
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,23 +1068,12 @@ main (){
|
|||||||
OPTIND=1
|
OPTIND=1
|
||||||
HAS_P=0
|
HAS_P=0
|
||||||
HAS_M=0
|
HAS_M=0
|
||||||
SPECIFIED_VERSION=""
|
while getopts :cudpmv flag; do
|
||||||
while getopts :cudpmvV: flag; do
|
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
p) HAS_P=1 ;;
|
p) HAS_P=1 ;;
|
||||||
m) HAS_M=1 ;;
|
m) HAS_M=1 ;;
|
||||||
V) SPECIFIED_VERSION="$OPTARG" ;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if [ -n "$SPECIFIED_VERSION" ]; then
|
|
||||||
LATEST="$SPECIFIED_VERSION"
|
|
||||||
case "$LATEST" in
|
|
||||||
v*) ;;
|
|
||||||
*) LATEST="v${LATEST}" ;;
|
|
||||||
esac
|
|
||||||
BRANCH="release-${LATEST}"
|
|
||||||
echo "Using Netmaker $LATEST (compose/assets from branch $BRANCH)"
|
|
||||||
fi
|
|
||||||
OPTIND=1
|
OPTIND=1
|
||||||
|
|
||||||
if [ "$HAS_M" -eq 1 ]; then
|
if [ "$HAS_M" -eq 1 ]; then
|
||||||
@@ -1094,7 +1082,7 @@ main (){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
INSTALL_TYPE="ce"
|
INSTALL_TYPE="ce"
|
||||||
while getopts :cudpmvV: flag; do
|
while getopts :cudpmv flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
c)
|
c)
|
||||||
INSTALL_TYPE="ce"
|
INSTALL_TYPE="ce"
|
||||||
@@ -1139,9 +1127,6 @@ main (){
|
|||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
V)
|
|
||||||
# LATEST/BRANCH already applied after first getopts pass
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user