mirror of
https://github.com/floci-io/floci.git
synced 2026-12-04 18:48:00 -05:00
* fix(ec2): remove a VPC's network after a restart too deleteVpcNetwork removed a VPC's Docker network only when this process had materialised it (vpc.created), which happens when an instance in the VPC starts. After a restart, a VPC that kept its network from the previous run but had no instance started since was deleted without its network: the bridge outlived the VPC and held its CIDR, so the next VPC declaring that CIDR collided with it. Reproduced by: run an instance in a VPC, restart with persisted state, terminate it, delete the VPC, create one with the same CIDR. Startup reconciliation already lists this deployment's VPC networks and keeps those whose VPC is still declared; it now remembers them, and deleting such a VPC removes its network. The listing runs whether or not reconcile-on-startup is on (only reaping orphans is behind that flag), so the fix does not depend on it. Upstream #5869 already detaches Floci before removal; this keeps that path. * fix(ec2): remove a restored VPC's network by the name it has Startup reconciliation remembered only which VPCs kept a network from a previous run, and deleting such a VPC then removed the name this version computes, floci-aws-vpc-.... A network created before the floci-aws- prefix is named floci-vpc-...; removing the computed name found nothing, the NotFound was ignored, and the old bridge kept holding the CIDR. Reconciliation now records each surviving network's own name and the deletion removes that one, along with the computed one if this run materialised it. * test(ec2): cover deleting a VPC this run materialised after a restart A VPC an instance started in after the restart has both the network this run created and the one its predecessor left. Deleting it removes both when the predecessor's carries a legacy name, and removes one network once when this run reused the predecessor's. * fix(ec2): remember every surviving network of a VPC after a restart Startup reconciliation kept one network name per VPC, so when both the legacy-named and the current-named bridge survived, deleting the VPC before this run materialised it left one behind with its CIDR reserved.