Browse Source

WIP

Signed-off-by: Alejandro Mery <amery@jpi.io>
dev-amery-wg1
Alejandro Mery 5 months ago
parent
commit
a1164027dc
  1. 11
      pkg/cluster/rings.go

11
pkg/cluster/rings.go

@ -3,6 +3,7 @@ package cluster
import (
"fmt"
"io/fs"
"log"
"net/netip"
"strconv"
@ -231,26 +232,36 @@ func (r *Ring) setRingOneGatewayAllowedIPs(rp *RingPeer) {
// peer
rp.AllowCIDR(rp.Address, 32)
log.Println(rp.Node.Name, "0:", rp.Address, regionID, zoneID)
// ring1 gateways connect to all other ring1 networks
r.ForEachZone(func(z *Zone) bool {
log.Println(rp.Node.Name, "1:", z.Name, z.RegionID(), z.ID)
if !z.Is(regionID, zoneID) {
subnet := z.RingOnePrefix()
rp.AllowSubnet(subnet)
log.Println(rp.Node.Name, "1.1:", rp.PeerConfig.AllowedIPs)
}
return false
})
// ring1 gateways also connect to all ring0 addresses
r.ForEachZone(func(z *Zone) bool {
log.Println(rp.Node.Name, "2:", z.Name, z.RegionID(), z.ID)
z.ForEachMachine(func(p *Machine) bool {
log.Println(rp.Node.Name, "2.1:", p.Name, p.IsGateway())
if p.IsGateway() {
addr, _ := p.RingZeroAddress()
rp.AllowCIDR(addr, 32)
log.Println(rp.Node.Name, "2.2:", rp.PeerConfig.AllowedIPs)
}
return false
})
return false
})
log.Println(rp.Node.Name, "3:", rp.PeerConfig.AllowedIPs)
}
func (*Ring) setRingOneNodeAllowedIPs(rp *RingPeer) {

Loading…
Cancel
Save