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()
|
||||
}
|
||||
|
||||
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.
|
||||
func NotifyMetricExportIntervalChanged() {
|
||||
select {
|
||||
case metricExportIntervalReset <- struct{}{}:
|
||||
default:
|
||||
metricExportIntervalMu.Lock()
|
||||
defer metricExportIntervalMu.Unlock()
|
||||
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
|
||||
func GetMetricInterval() string {
|
||||
return GetServerSettings().MetricInterval
|
||||
|
||||
@@ -150,6 +150,7 @@ func Keepalive(ctx context.Context) {
|
||||
warmPeerCaches()
|
||||
StartPeerUpdateWorker(ctx)
|
||||
go PublishPeerUpdate(true)
|
||||
metricIntervalReset := logic.SubscribeMetricExportIntervalReset()
|
||||
metricsTicker := time.NewTicker(normalizedMetricsExportInterval())
|
||||
defer metricsTicker.Stop()
|
||||
if servercfg.CacheEnabled() {
|
||||
@@ -166,7 +167,7 @@ func Keepalive(ctx context.Context) {
|
||||
logic.FlushNodeCheckins()
|
||||
case <-metricsTicker.C:
|
||||
PushAllMetricsToExporter()
|
||||
case <-logic.MetricExportIntervalReset():
|
||||
case <-metricIntervalReset:
|
||||
metricsTicker.Stop()
|
||||
metricsTicker = time.NewTicker(normalizedMetricsExportInterval())
|
||||
}
|
||||
@@ -180,7 +181,7 @@ func Keepalive(ctx context.Context) {
|
||||
sendPeers()
|
||||
case <-metricsTicker.C:
|
||||
PushAllMetricsToExporter()
|
||||
case <-logic.MetricExportIntervalReset():
|
||||
case <-metricIntervalReset:
|
||||
metricsTicker.Stop()
|
||||
metricsTicker = time.NewTicker(normalizedMetricsExportInterval())
|
||||
}
|
||||
|
||||
+4
-1
@@ -58,8 +58,11 @@ func handleServerSync(_ mqtt.Client, msg mqtt.Message) {
|
||||
|
||||
switch syncMsg.SyncType {
|
||||
case logic.SyncTypeSettings:
|
||||
oldInterval := logic.GetMetricInterval()
|
||||
logic.InvalidateServerSettingsCache()
|
||||
logic.NotifyMetricExportIntervalChanged()
|
||||
if logic.GetMetricInterval() != oldInterval {
|
||||
logic.NotifyMetricExportIntervalChanged()
|
||||
}
|
||||
case logic.SyncTypePeerUpdate:
|
||||
logic.InvalidateHostPeerCaches()
|
||||
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 " -u if specified, will upgrade netmaker to pro 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
|
||||
}
|
||||
|
||||
@@ -1069,23 +1068,12 @@ main (){
|
||||
OPTIND=1
|
||||
HAS_P=0
|
||||
HAS_M=0
|
||||
SPECIFIED_VERSION=""
|
||||
while getopts :cudpmvV: flag; do
|
||||
while getopts :cudpmv flag; do
|
||||
case "${flag}" in
|
||||
p) HAS_P=1 ;;
|
||||
m) HAS_M=1 ;;
|
||||
V) SPECIFIED_VERSION="$OPTARG" ;;
|
||||
esac
|
||||
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
|
||||
|
||||
if [ "$HAS_M" -eq 1 ]; then
|
||||
@@ -1094,7 +1082,7 @@ main (){
|
||||
fi
|
||||
|
||||
INSTALL_TYPE="ce"
|
||||
while getopts :cudpmvV: flag; do
|
||||
while getopts :cudpmv flag; do
|
||||
case "${flag}" in
|
||||
c)
|
||||
INSTALL_TYPE="ce"
|
||||
@@ -1139,9 +1127,6 @@ main (){
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
V)
|
||||
# LATEST/BRANCH already applied after first getopts pass
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user