Skip to content

Egress routes outlive a removed tenant VRF #1495

Done

Description

@privateip

Summary

After the lab's combined Worker check removed its fixture VRFs from an edge node, the node kept egress group routes for both VRF tables. The routes survived a CNI restart and the check's own cleanup window, and the next NAT active-active check failed because the node counted four routes for two VRFs.

Recovering the lab took a full redeploy, and a combined node that keeps adding and removing tenants could collect these routes over time.

It is not known yet whether a normal pod deletion leaks them the same way.

Acceptance criteria

  • Removing a tenant VRF leaves no egress routes for its table once cleanup finishes
  • The NAT active-active check passes after the combined Worker check on the same deploy

Related to #1430

Activity

  1. privateip commented on Nov 24, 2026

    @privateip
    ContributorAuthor

    Evidence from one lab run on the integration branch at 35dc24b, before the branch was rebased onto main. Times are relative to the fixture cleanup at T.

    • At T the combined Worker check's cleanup removed the fixture VRFs for VPCs 80 and 81, tables 3 and 4, from the edge node, under each VPC's fence lock as GC would. That run had already failed on Worker routed links fail on attachments CNI attached #1494's routed link step, so it never reached its own wait for leftover egress_route_table rows.
    • At about T+14 min verify:nat-active-active failed: reports 4 nat66 routes on its group, want 2, one per tenant VRF. The node had two VRFs.
    • At about T+15 min, after deleting the galactic-cni pods on both edge nodes, the refresh sweep logged scanned 35, refreshed 8, removed 0 and still moved rows for tables 3 and 4 between the shard group and a single shard. A retry failed the same way.
    • The fence records for VPCs 80 and 81 stayed on the node with a galactic-handback: owner and pending: true, which the Worker docs describe as expected.

    The rows live in a pinned map, which explains why a CNI restart keeps them. What is missing is the removal of rows whose VRF table no longer exists. A destroy and redeploy cleared it, and task verify then passed 27 of 27.

  2. added
    galactic-nat
    galactic-cni
    bug
    on Nov 24, 2026
  3. added theissue type on Nov 24, 2026
  4. self-assigned this
    on Nov 24, 2026
  5. privateip commented on Nov 24, 2026

    @privateip
    ContributorAuthor

    Confirmed on integration/galactic-worker at 35dc24b486566668c225c69852e28ca04d8af53c from the saved qualification logs. The combined Worker fixture removed its VRFs after the routed-link failure tracked in #1494. The following NAT active-active check counted stale NAT66 group entries and failed again after CNI restarted.

    The table sweep retains egress entries for a missing host VRF while its table is still reserved or a vrf_table row refers to it. The existing tests explicitly cover that behavior. task build:ebpf and go test ./internal/gc -run TestSweepVRFTableState -count=1 passed on the integration revision. The captured run did not reach the fixture's cleanup wait, and the saved logs do not establish which reference delayed the sweep or whether normal pod deletion has the same symptom.

  6. privateip commented on Nov 24, 2026

    @privateip
    ContributorAuthor

    Approved fix plan. Prune egress rows for absent host VRFs under the existing VRF lock. Keep table IDs reserved while references remain and require successful route cleanup before returning an ID to the allocator. Extend the GC tests to cover missing VRFs with lingering references, live VRFs, and sidecar tables. Confirm the combined Worker and NAT active-active checks on one deployment once the routed-link prerequisite in #1494 is available.

  7. privateip commented on Nov 24, 2026

    @privateip
    ContributorAuthor

    Review found that pruning all rows while the table is still reserved can remove learned routes that GoBGP does not replay when a VRF returns on that same table. The revised fix keeps the production reservation and garbage collection safeguards. The Worker fixture will wait for egress cleanup even after an earlier check fails, and it will require successful reads of the VRFs and map before reporting cleanup. The original Worker failure remains visible. The managed lab test will run NAT active-active after Worker teardown on the same deployment.

  8. privateip commented on Nov 24, 2026

    @privateip
    ContributorAuthor

    The revised cleanup ran after the combined Worker check hit #1494 and preserved the original failure. Once teardown finished, NAT active-active passed on the same deployment, including the previously failing route count. A follow-up read verified that no egress rows remained for absent VRFs. The patch is in #1496.

  9. privateip commented on Nov 24, 2026

    @privateip
    ContributorAuthor

    Completed by #1496, merged into integration/galactic-worker at 9c8c5051929e09131e8ebb9795dcedf15a93b27e. Worker teardown now waits for egress cleanup even if the check fails. NAT active-active passed on the same deployment after teardown, and a follow-up map read found no stale egress rows. The routed-link failure remains tracked in #1494.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggalactic-cnigalactic-nat

Type

Fields

Priority

Low

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions