mirror of
https://github.com/outbackdingo/talos-cloud-controller-manager.git
synced 2026-01-28 02:20:18 +00:00
feat: ipv6 small subnets
Set a limit of 32 pods per node in your Kubernetes cluster. Some cloud providers offer a /123 IPv6 subnet for nodes, which is typically sufficient for most use cases. Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
This commit is contained in:
@@ -628,8 +628,10 @@ func (r *cloudAllocator) addCIDRSet(cidr string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mask = 80
|
mask = 80
|
||||||
case mask > 120:
|
case mask > 123:
|
||||||
return fmt.Errorf("CIDRv6 is too small: %v", subnet.String())
|
return fmt.Errorf("CIDRv6 is too small: %v", subnet.String())
|
||||||
|
case mask > 119:
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
mask += 16
|
mask += 16
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,11 +65,23 @@ func TestAddCIDRSet(t *testing.T) {
|
|||||||
expectedClusterCIDR: netip.MustParsePrefix("2000::aaaa:bbbb:cccc:0/112"),
|
expectedClusterCIDR: netip.MustParsePrefix("2000::aaaa:bbbb:cccc:0/112"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "CIDRv6 with mask size 120",
|
name: "CIDRv6 with mask size 120, 256 pods",
|
||||||
cidr: "2000::aaaa:bbbb:cccc:123/120",
|
cidr: "2000::aaaa:bbbb:cccc:123/120",
|
||||||
expectedSize: 1,
|
expectedSize: 1,
|
||||||
expectedClusterCIDR: netip.MustParsePrefix("2000::aaaa:bbbb:cccc:100/120"),
|
expectedClusterCIDR: netip.MustParsePrefix("2000::aaaa:bbbb:cccc:100/120"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "CIDRv6 with mask size 122, 64 pods",
|
||||||
|
cidr: "2000::aaaa:bbbb:cccc:123/122",
|
||||||
|
expectedSize: 1,
|
||||||
|
expectedClusterCIDR: netip.MustParsePrefix("2000::aaaa:bbbb:cccc:100/122"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "CIDRv6 with mask size 123, 32 pods",
|
||||||
|
cidr: "2000::aaaa:bbbb:cccc:123/123",
|
||||||
|
expectedSize: 1,
|
||||||
|
expectedClusterCIDR: netip.MustParsePrefix("2000::aaaa:bbbb:cccc:120/123"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "CIDRv6 with mask size 124",
|
name: "CIDRv6 with mask size 124",
|
||||||
cidr: "2000::aaaa:bbbb:cccc:123/124",
|
cidr: "2000::aaaa:bbbb:cccc:123/124",
|
||||||
|
|||||||
Reference in New Issue
Block a user