Merge pull request #3963 from gravitl/fixes/release-v1.5.1

Fixes: release-v1.5.1
This commit is contained in:
Abhishek Kondur
2026-04-08 11:43:41 +05:30
committed by GitHub
5 changed files with 65 additions and 44 deletions
+2 -1
View File
@@ -336,7 +336,8 @@ func reInit(curr, new models.ServerSettings, force bool) {
// On force AutoUpdate change, change AutoUpdate for all hosts.
// On force FlowLogs enable, enable FlowLogs for all hosts.
// On FlowLogs disable, forced or not, disable FlowLogs for all hosts.
if force || !new.EnableFlowLogs {
// On NetclientAutoUpdate disable, forced or not, disable AutoUpdate for all hosts.
if force || !new.EnableFlowLogs || !new.NetclientAutoUpdate {
if curr.NetclientAutoUpdate != new.NetclientAutoUpdate ||
curr.EnableFlowLogs != new.EnableFlowLogs {
hosts, _ := (&schema.Host{}).ListAll(db.WithContext(context.TODO()))
+47 -32
View File
@@ -7,6 +7,7 @@ import (
"log"
"net"
"slices"
"strings"
"time"
"golang.org/x/exp/slog"
@@ -589,6 +590,9 @@ func migrateToEgressV1() {
CreatedBy: user.UserName,
CreatedAt: time.Now().UTC(),
}
if !e.Nat {
e.Mode = schema.DisabledNAT
}
err = e.Create(db.WithContext(context.TODO()))
if err == nil {
acl := models.Acl{
@@ -838,42 +842,53 @@ func migrateNameservers() {
if !node.IsGw {
continue
}
if node.IngressDNS != "" {
if (node.Address.IP != nil && node.Address.IP.String() == node.IngressDNS) ||
(node.Address6.IP != nil && node.Address6.IP.String() == node.IngressDNS) {
continue
var nsIPs []string
for _, nsIP := range strings.Split(node.IngressDNS, ",") {
nsIP = strings.TrimSpace(nsIP)
if (node.Address.IP != nil && node.Address.IP.String() == nsIP) ||
(node.Address6.IP != nil && node.Address6.IP.String() == nsIP) {
continue
}
if nsIP == "8.8.8.8" || nsIP == "1.1.1.1" || nsIP == "9.9.9.9" {
continue
}
nsIPs = append(nsIPs, nsIP)
}
if node.IngressDNS == "8.8.8.8" || node.IngressDNS == "1.1.1.1" || node.IngressDNS == "9.9.9.9" {
continue
}
host := &schema.Host{
ID: node.HostID,
}
err := host.Get(db.WithContext(context.TODO()))
if err != nil {
continue
}
ns := schema.Nameserver{
ID: uuid.NewString(),
Name: fmt.Sprintf("%s gw nameservers", host.Name),
NetworkID: node.Network,
Servers: []string{node.IngressDNS},
MatchAll: true,
Domains: []schema.NameserverDomain{
{
Domain: ".",
if len(nsIPs) > 0 {
host := &schema.Host{
ID: node.HostID,
}
err := host.Get(db.WithContext(context.TODO()))
if err != nil {
continue
}
ns := schema.Nameserver{
ID: uuid.NewString(),
Name: fmt.Sprintf("%s gw nameservers", host.Name),
NetworkID: node.Network,
Servers: nsIPs,
MatchAll: true,
Domains: []schema.NameserverDomain{
{
Domain: ".",
},
},
},
Nodes: datatypes.JSONMap{
node.ID.String(): struct{}{},
},
Tags: make(datatypes.JSONMap),
Status: true,
CreatedBy: superAdmin.Username,
Nodes: datatypes.JSONMap{
node.ID.String(): struct{}{},
},
Tags: make(datatypes.JSONMap),
Status: true,
CreatedBy: superAdmin.Username,
}
_ = ns.Create(db.WithContext(context.TODO()))
node.IngressDNS = ""
_ = logic.UpsertNode(&node)
}
_ = ns.Create(db.WithContext(context.TODO()))
node.IngressDNS = ""
_ = logic.UpsertNode(&node)
}
}
}
+11 -8
View File
@@ -255,12 +255,19 @@ func migrateNetworks(ctx context.Context) error {
}
for _, nsIP := range network.NameServers {
if net.ParseIP(nsIP) == nil {
ip := net.ParseIP(nsIP)
if ip == nil {
continue
}
if (cidr != nil && !cidr.Contains(net.ParseIP(nsIP))) &&
(cidrv6 != nil && !cidrv6.Contains(net.ParseIP(nsIP))) {
ns.Servers = append(ns.Servers, nsIP)
if ip.To4() != nil {
if cidr != nil && !cidr.Contains(ip) {
ns.Servers = append(ns.Servers, nsIP)
}
} else {
if cidrv6 != nil && !cidrv6.Contains(ip) {
ns.Servers = append(ns.Servers, nsIP)
}
}
}
@@ -405,10 +412,6 @@ func migrateHosts(ctx context.Context) error {
}
}
if _host.IsDefault && !_host.AutoUpdate {
_host.AutoUpdate = true
}
logger.Log(4, fmt.Sprintf("migrating host %s", _host.ID))
err = _host.Create(ctx)
+2 -1
View File
@@ -140,7 +140,8 @@ func ValidateLicense() (err error) {
proLogic.SetFeatureFlags(licenseResponse.FeatureFlags)
proLogic.SetDeploymentMode(licenseResponse.DeploymentMode)
_ = mq.PublishExporterFeatureFlags()
go mq.PublishExporterFeatureFlags()
go mq.PublishPeerUpdate(false)
slog.Info("License validation succeeded!")
return nil
+3 -2
View File
@@ -13,8 +13,9 @@ const egressTable = "egresses"
type EgressNATMode string
const (
VirtualNAT EgressNATMode = "virtual_nat"
DirectNAT EgressNATMode = "direct_nat"
DisabledNAT EgressNATMode = "disabled"
VirtualNAT EgressNATMode = "virtual_nat"
DirectNAT EgressNATMode = "direct_nat"
)
type Egress struct {