metal-stack/go-ipam

Support prefix allocation with variable length

Closed this issue · 7 comments

Currently, according to

// FIXME allow variable child prefix length
, only a single type (length) of the prefix for allocation is supported.

I'm looking for a solution that supports variable prefix allocation e.g. /24 /23 /22 again /24

Any chance that it can be implemented soon? @majst01

This, together with full ipv6 support are our last main open topics in go-ipam.
It is quite difficult to implement while still being fast.
The problem with variable child prefix length is to solve the binpacking without loosing to much space, also freeing it up again once a child prefix is deleted.

If you are willing to contribute, i am happy to support you in this effort.

May i ask you what use case are you solve with go-ipam ?

Hello @majst01,

We are interested only in IPv4 support (yes, yes...).
Our use case is pretty straightforward tbh, we have big multi-tenancy foundation (different clouds) and a big intranet network, the foundation dynamically allocates namespaces (cloud resources, e.g. VMs, K8s) and we have a unified network control and management plane where we have IPAM and as part of lean and efficient subnets consumption, we dynamically allocate subnets (multi-tenant scenario here) based on namespace size (that can be /24 /23 .... etc) prefixes from specific network pools (for example regions). The process is fully automation and we don't have any significant performance requirements (we can live with 1 rps/pool here).

@majst01 side note, I'm looking for a solution or maybe a nice idea of implementation.

I'm exploring calico's ipam - https://www.tigera.io/blog/calico-ipam-explained-and-enhanced/
Within Calico’s IPAM engine, these IP pools are subdivided into smaller chunks – called blocks – which are then assigned to particular nodes in the cluster. Blocks are allocated dynamically to nodes as the number of running pods grows or shrinks. In particular, this means that Calico is much more efficient in its use of IP addresses when only a few pods are running on a node, and at the same time doesn’t impose any upper limit on the number of pods per node.
Starting from 3.3 dynamic block allocation announced:

Configurable block sizes: Until now, the number of IP addresses in each block has been fixed at 64 (or “/26” in CIDR notation). This default was chosen because it works well for most users. However, for some users under intense IP address pressure, or those with special-case needs, a smaller IP pool and block size may be required.

https://github.com/projectcalico/libcalico-go/blob/master/lib/ipam/ipam_block.go

My next step is to play with IPAM https://github.com/projectcalico/libcalico-go/blob/master/lib/ipam/ipam_block.go and decouple it from calico.

Nice finding and thanks for the pointer. As i said i am willing to help to add this feature to go-ipam.

Is addressed in #36

Closed in favor of #36

@hayorov we are quite close in merging #36, so stay tuned :-)