Keep the internal IP on restore and refresh svclb

Closes #42 (closed)

What changes

A caproni rig recreated by restore came back on a new internal IP, and the k3s svclb forwarder pods kept iptables rules for the old one. The lab then did not answer on its external address for minutes, and restore reported success without checking.

  • down --keep-snapshot reserves the rig's internal address next to the external one, and a recreate pins the VM to it (--private-network-ip). No reservation means a warning and a new IP.
  • restore on caproni deletes the svclb pods once k3s answers, then waits for external HTTP 200, bounded by SIM_RESTORE_SERVE_SECONDS (900). Both restore paths do this.
  • status --json adds internal_ip: schema 12 (the AI Gateway tag change took 11 first). The #32 work adds provider, region and zone at the next version after this one, so it can share that bump.
  • Reservations are released on success, and down and reap remove them with the rest.
flowchart TD
  A["down --keep-snapshot"] --> B["reserve external address"]
  B --> C["reserve internal address (new)"]
  C --> D["delete VM, keep snapshot"]
  D --> E["restore"]
  E --> F{"VM exists?"}
  F -- "no" --> G["recreate VM pinned to the reserved internal IP (new)"]
  F -- "yes" --> H["stop, swap boot disk, start"]
  G --> I["release both reservations"]
  H --> I
  I --> J["caproni: delete svclb pods once k3s answers (new)"]
  J --> K["wait for external HTTP 200 (new)"]
  K --> L["restored"]

Evidence

Live caproni rig, --no-aigw, one instance:

  • In-place restore keeps the internal IP (10.128.0.58 before and after, old engine). It is not the path that moves it.
  • Recreate after down --keep-snapshot with the old engine: internal IP 10.128.0.58 became 10.128.0.60; rules for the old address were still in the nat table after boot; external HTTP timed out, then 502, then 200 only once the forwarder containers restarted themselves.
  • New engine, in-place restore: svclb pods replaced, the engine gate reported 200 on the external address.
  • New engine, recreate after down --keep-snapshot: both reservations held (10.128.0.60 and the external address), the VM came back on 10.128.0.60, the svclb pods were replaced, and the gate reported 200 with no manual repair. A zone stockout on the first create left the snapshot and reservations intact, and the second restore completed.
  • Teardown left no instances, snapshots, addresses or disks.

Tests

Engine self-test checks go red without each change: the internal reservation, the pinned recreate, the unreserved fallback, the svclb refresh on both paths, the serve gate, the reservation release, and schema 12 with internal_ip. Word budget stays at the 40489 ceiling: the added doc words are paid for by equal cuts in operations.md.

Merge request reports

Loading
Loading