mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 17:51:56 +08:00
NET-1440: scale test changes (#3014)
* NET-1440 scale test changes * fix UT error and add error info * load metric data into cacha in startup * remove debug info for metric * add server telemetry and hasSuperAdmin to cache * fix user UT case * update sqlite connection string for performance * update check-in TS in cache only if cache enabled * update metric data in cache only if cache enabled and write to DB once in stop * update server status in mq topic * add failover existed to server status update * only send mq messsage when there is server status change * batch peerUpdate * code changes for scale for review * update UT case * update mq client check * mq connection code change * revert server status update changes * revert batch peerUpdate * remove server status update info * code changes based on review and setupmqtt in keepalive * set the mq message order to false for PIN * remove setupmqtt in keepalive * recycle ip in node deletion * update ip allocation logic * remove ip addr cap * remove ippool file * update get extClient func * remove ip from cache map when extClient is removed
This commit is contained in:
@@ -116,6 +116,7 @@ func UpdateNodeCheckin(node *models.Node) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = database.Insert(node.ID.String(), string(data), database.NODES_TABLE_NAME)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -300,6 +301,13 @@ func DeleteNodeByID(node *models.Node) error {
|
||||
if err = DeleteMetrics(node.ID.String()); err != nil {
|
||||
logger.Log(1, "unable to remove metrics from DB for node", node.ID.String(), err.Error())
|
||||
}
|
||||
//recycle ip address
|
||||
if node.Address.IP != nil {
|
||||
RemoveIpFromAllocatedIpMap(node.Network, node.Address.IP.String())
|
||||
}
|
||||
if node.Address6.IP != nil {
|
||||
RemoveIpFromAllocatedIpMap(node.Network, node.Address6.IP.String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -585,6 +593,14 @@ func createNode(node *models.Node) error {
|
||||
if servercfg.CacheEnabled() {
|
||||
storeNodeInCache(*node)
|
||||
}
|
||||
if _, ok := allocatedIpMap[node.Network]; ok {
|
||||
if node.Address.IP != nil {
|
||||
AddIpToAllocatedIpMap(node.Network, node.Address.IP)
|
||||
}
|
||||
if node.Address6.IP != nil {
|
||||
AddIpToAllocatedIpMap(node.Network, node.Address6.IP)
|
||||
}
|
||||
}
|
||||
_, err = nodeacls.CreateNodeACL(nodeacls.NetworkID(node.Network), nodeacls.NodeID(node.ID.String()), defaultACLVal)
|
||||
if err != nil {
|
||||
logger.Log(1, "failed to create node ACL for node,", node.ID.String(), "err:", err.Error())
|
||||
|
Reference in New Issue
Block a user