fix(network): stop injecting ipRange into the CNI config - #5078
fix(network): stop injecting ipRange into the CNI config#5078mayur-tolexo wants to merge 1 commit into
Conversation
host-local's IPAM range has no ipRange field, so `network create --ip-range` was writing a property the plugin ignores into the on-disk conflist. Drop it and instead recompute the range CIDR from rangeStart/rangeEnd when reporting IPRange in `network inspect`, which is the only place the value was read back. Fixes containerd#5068 Signed-off-by: Mayur Das <mayur.das@neevcloud.com>
c7aebfd to
7191d26
Compare
|
Re-verified inspect parity against Docker 29.4.0 with this branch built in a Linux/containerd sandbox. The fix drops nerdctl built off this branch: Docker 29.4.0, same inputs: IPRange comes out identical to Docker in all three, including the /25 that doesn't align to the subnet prefix and the v6 /64. (The gateway still differs because nerdctl defaults it to .1 of the subnet rather than the range's network address, which is a pre-existing default unrelated to this change.) And the actual point of the fix — the field is no longer written to the on-disk conflist, and inspect rebuilds it from the bounds host-local does store: rangeStart 172.28.5.1 / rangeEnd 172.28.5.255 invert back to 172.28.5.0/24, which is what inspect reports. The v6 case stores rangeEnd One limitation worth noting: a |
Fixes #5068.
network create --ip-rangewas writing anipRangeproperty into the host-local IPAM ranges on disk, but host-local has no such field — it only readssubnet/rangeStart/rangeEnd/gatewayand silently ignores anything else. So the property never affected allocation; it was only being read back bynetwork inspect(via case-insensitive JSON) to report Docker'sIPRange.This drops the field from the CNI config and instead recomputes the range CIDR from
rangeStart/rangeEndat inspect time.FirstIPInSubnetonly bumps the network's last byte andLastIPInSubnetgives the broadcast, so the bounds invert cleanly back to the original CIDR.network inspectstill reports the sameIPRangeas before and as Docker — the existing inspect e2e that asserts it is unchanged, plus a unit test covers the reconstruction across v4/v6 prefixes.Same class of issue as
--aux-addressin #5041; there the reserved pairs aren't derivable so they move to a nerdctl label, whereasipRangeis fully derivable and needs no storage.Keeping this a draft until #5041 settles, since both touch the same IPAM code and I'll rebase whichever lands second.