Skip to content

Commit 0121857

Browse files
authored
fix(lb): ACL with /32 subnets were not matching properly (#162)
1 parent 8eec6b2 commit 0121857

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

scaleway/loadbalancers.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2243,7 +2243,7 @@ func makeACLSpecs(service *v1.Service, nodes []*v1.Node, frontend *scwlb.Fronten
22432243
aclPrefix := makeACLPrefix(frontend)
22442244
whitelist := extractNodesInternalIps(nodes)
22452245
whitelist = append(whitelist, extractNodesExternalIps(nodes)...)
2246-
whitelist = append(whitelist, service.Spec.LoadBalancerSourceRanges...)
2246+
whitelist = append(whitelist, strip32SubnetMasks(service.Spec.LoadBalancerSourceRanges)...)
22472247

22482248
slices.Sort(whitelist)
22492249

@@ -2277,6 +2277,14 @@ func makeACLSpecs(service *v1.Service, nodes []*v1.Node, frontend *scwlb.Fronten
22772277
return acls
22782278
}
22792279

2280+
func strip32SubnetMasks(subnets []string) []string {
2281+
stripped := make([]string, len(subnets))
2282+
for idx, subnet := range subnets {
2283+
stripped[idx] = strings.TrimSuffix(subnet, "/32")
2284+
}
2285+
return stripped
2286+
}
2287+
22802288
func ptrInt32ToString(i *int32) string {
22812289
if i == nil {
22822290
return "<nil>"

0 commit comments

Comments
 (0)