Allow to change Calico blockSize via Charm

Upstream Calico CNI allows to set the blocksize, which is defined as:

The CIDR size of allocation blocks used by this pool. Blocks are allocated on demand to hosts and are used to aggregate routes. The value can only be set when the pool is created.


While a /26 subnet is a sensible default, some scenarios may benefit from a flexible blockSize parameter, either

  1. to save address space (for example, by changing /26 to /28) or, on the contrary,

  2. to support a greater number of containers/pods per worker node (such as 127, which would correspond to a /25).

At a high level, blockSize could be added in the Calico Charm by introducing a method such as cluster_blocksize() in, to return the blocksize value defined in the configuration, much like it’s already done with cluster_cidr(). Changing the kubeproxy configuration shouldn’t be necessary as far as I can tell.