publish dns on node creation

This commit is contained in:
Matthew R Kasun
2023-02-06 07:32:37 -05:00
parent 2c36dfb0bf
commit a441e35a09
2 changed files with 93 additions and 0 deletions

View File

@@ -671,6 +671,21 @@ func createNode(w http.ResponseWriter, r *http.Request) {
}
}()
//runForceServerUpdate(&data.Node, true)
dns := models.DNSUpdate{
Action: models.DNSInsert,
Address: data.Node.Address.IP.String(),
Name: data.Host.Name + data.Node.Network,
}
go func() {
//publish new node dns entry to all nodes on network
if err := mq.PublishDNSUpdate(data.Node.Network, dns); err != nil {
logger.Log(1, "failed to publish dns update on node creation", err.Error())
}
//publish add dns records for network to new node
if err := mq.PublishAllDNS(&data.Node); err != nil {
logger.Log(1, "failed to publish dns update on node creation", err.Error())
}
}()
}
// == EGRESS ==