Skip to content

fix: Keep private services up when the CNI recreates a drop counter map - #1575

Open
privateip wants to merge 2 commits into
mainfrom
fix/issue-1569
Open

privateip wants to merge 2 commits into
mainfrom
fix/issue-1569

Conversation

@privateip

@privateip privateip commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Private-service traffic on a node stopped whenever galactic-cni recreated an eBPF map, even one like the drop counters that holds no service authorization.

The CNI closed the service gate, emptied the authorization tables and gave every attachment a new identity token, so traffic stayed down until galactic-router rebuilt its policy.

The CNI now does that only when one of the ten maps that hold service authorization changes, and keeps the gate, tables and tokens otherwise.

A change to one of those ten maps still fails closed, as before.

Test plan

  • In the containerlab, on a compute node with eight attachments, recreating the drop counters keeps the gate open and every token through a CNI restart and then a router restart; on main the same steps close the gate and rotate all eight tokens
  • In the containerlab, recreating a policy map still drains authorization and rotates tokens, and a router restart reopens the gate
  • Build, lint and unit tests pass
  • Root-gated kernel tests and the e2e lifecycle test pass in CI

Fixes #1569

When galactic-cni recreated any incompatible pinned map, it drained
service authorization first: it closed the node's service policy gate
and emptied the access, reverse and remote grant tables. A recreated
map also gave the new egress programs different map IDs, so every
attachment got a new identity token, and service rows carrying the old
token stopped matching. Growing drop_reasons by one entry therefore
stopped private-service traffic on the node until galactic-router
rebuilt its generation, and a router that restarted after the CNI kept
the gate closed until its startup sync finished.

Service authorization lives in ten maps, the set the router already
tracks by kernel map ID. A map outside that set holds no authorization,
so an old classifier still running against it cannot widen access.

- prog.ServicePolicyMapNames names the set, and the router uses it.
- mappin.Incompatible reports incompatible pins without removing them.
- Load drains authorization only when a policy map is incompatible, or
  when it cannot tell which maps are.
- The egress chain keeps its tokens when old and new programs reference
  the same maps by name and shape and share every policy map's kernel
  ID. Shape tells apart the two policy maps whose kernel names collide
  once truncated. A program that references a new map still gets new
  tokens, and a kernel that reports no map names falls back to
  comparing every map ID.

A policy map change still drains and fails closed.

Fixes #1569
@privateip privateip self-assigned this Dec 2, 2026
@privateip
privateip requested a review from scotwells December 2, 2026 02:13
@privateip privateip changed the title fix: Keep private services up when the CNI recreates an unrelated map fix: Keep private services up when the CNI recreates a drop counter map Dec 2, 2026
@privateip
privateip marked this pull request as ready for review December 2, 2026 02:35
@privateip
privateip requested a review from a team as a code owner December 2, 2026 02:35
@privateip
privateip enabled auto-merge December 2, 2026 02:35
@privateip

Copy link
Copy Markdown
Contributor Author

Both reviewers ran on the first pass. The fix phase applied the one comment nit in commit 8ef2d7d, and the PR title and the root-gated test row were updated to match the checks.

pr-adversary, VERDICT: merge.

pr-conventions-reviewer, VERDICT: hold, on the merge-order decision only.

What pr-adversary ran: gh pr view for the title, body and commits, gh api for issue 1569, gh pr checks, git diff --stat and the non-test, non-doc diff against the base, a grep of usid.c and serviceroutemap/table.go for map definitions, lookups and policy map name constants, go build ./..., go vet on the ebpf and serviceroute trees, and go test on the attach, mappin, prog and serviceroute packages.

What pr-conventions-reviewer ran: gh pr view for the title, body, commits, files, base and draft state, git diff --stat and the full diff against the base, gh pr list for open PRs with their files, gh pr view for the files of #1571 and #1572, and git merge-tree against #1571. That merge-tree run failed because the ref was not fetched, and the session settled the question as described below.

Merge order against #1571 and #1572: the session settled it. git merge-tree --write-tree is clean for this head with #1571, with #1572, and for #1571 with #1572. The three-way merge also passes go vet and race unit tests for the attach, prog, mappin and serviceroute packages.

Root-gated and e2e tests: the session settled this from CI. On adb8ac7 every check passed, including Unit Tests (root), which ran TestStartRecreatingNonPolicyMapKeepsServiceAuthorization, TestStartRecreatingPolicyMapDrainsServiceAuthorization and TestIncompatible_ReportsWithoutUnpinning, along with E2E Tests and ci / Build and test.

CI on 8ef2d7d passed every check, including Unit Tests (root), E2E Tests and ci / Build and test. The two skipped publish jobs also skipped on the previous head.

Auto-merge is set to merge commits, the only method the main ruleset allows. The ruleset requires one approval from a code owner and dismisses approvals on push, so the PR waits for a person before it merges. No human reviewer is configured for this repository, so code owners are the only requested reviewers.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Private services stop when galactic-cni replaces an unrelated eBPF map

1 participant