Skip to content

feat: Take the egress shard's identity from its EgressShard spec - #607

Merged
privateip merged 1 commit into
mainfrom
feat/issue-581-spec-identity
Sep 25, 2026
Merged

privateip merged 1 commit into
mainfrom
feat/issue-581-spec-identity

Conversation

@privateip

Copy link
Copy Markdown
Collaborator

Summary

Each egress shard's SID, masquerade addresses and NAT64 prefix were set by hand in a per-node patch, and the EgressShard object only echoed them back. They now come from the EgressShard's spec, uplinks are auto-detected the way the CNI detects its own, and the node name is the only required setting. This also fixes an unconfigured shard claiming traffic it had no identity for, because it read an empty config row as a match.

Breaking changes

The shard identity env vars and flags are gone; set the same values in each shard's EgressShard spec, which needs the network CRDs from datum-cloud/network#25 or later.

Test plan

  • Unit and privileged datapath tests pass
  • Lab shards reach Programmed from their spec and egress completes a round trip in both families
  • A node with no EgressShard attaches but translates nothing, and deleting a shard withdraws its advertisement

Resolves #581

🤖 Generated with Claude Code

galactic-nat took its shard SID, masquerade addresses, NAT64 prefix, and uplinks from env vars on its DaemonSet, so every shard node needed a hand-written per-node patch, and the EgressShard CRD only echoed back what the process was started with. The identity is a fabric-wide allocation decision, and the uplinks are the same ones the CNI's SRv6 datapath already derives from the node itself.

Drive the datapath from the CRD instead. The process attaches its XDP program at startup with no identity, and EgressShardReconciler programs shard_config_table from the spec of the one EgressShard targeting its node. Status now reports what the datapath is actually programmed with, and the BGP advertisement is built from status, so the fabric only learns an identity the node translates with.

Uplinks are auto-detected with the CNI's own derivation, so the shard and the CNI on a node converge on the same interfaces. XDP-specific bond handling resolves a bonding master to its slaves only. GALACTIC_NAT_UPLINK_INTERFACES remains as an override for nodes where detection is ambiguous.

An unconfigured shard previously claimed traffic it should not. shard_config_table is an array map, so the dispatcher's NULL check never fired: an unconfigured shard read an all-zero row whose zero SID matched every destination with a zero top 64 bits. The dispatcher now treats a row serving no family as unconfigured.

Key changes:
- Remove GALACTIC_NAT_SHARD_SID, _SHARD_PUB_ADDR6, _SHARD_PUB_ADDR4, and _NAT64_PREFIX with their flags; the node name is the only required setting
- Make GALACTIC_NAT_UPLINK_INTERFACES an optional override of auto-detection (natattach.ResolveUplinks over attach.DetectUplinks and ResolveTargets)
- Add the Programmed condition: AddressesProgrammed, AddressUnassigned, ProgrammingFailed, or ShardConflict when more than one EgressShard targets a node
- Clear the datapath and withdraw the advertisement when a node's shard is deleted or has no usable identity, including at startup for a shard deleted while the process was down
- Report healthy once attached rather than once programmed, so a node awaiting an identity does not block the DaemonSet rollout
- Enable IPv4 forwarding on the uplinks only once a shard is assigned an IPv4 address
- Gate the XDP dispatcher on the config row serving a family, add natmap ShardConfigTable.Clear, and read a zero row as unconfigured
- Move the containerlab shards' identity into each site's EgressShard spec and read the IPv4 address from status in the verify tasks
- Update the NAT configuration reference, lab README, and manifest comments
- Bump go.datum.net/network to main, which carries the spec fields (network#23, network#25), with no local replace
- Build ResolveUplinks on the bond expansion ResolveTargets already does, rather than a second copy of it

Resolves #581

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@privateip
privateip requested a review from a team as a code owner September 25, 2026 14:24
@privateip
privateip merged commit ed4231c into main Sep 25, 2026
12 checks passed
@privateip
privateip deleted the feat/issue-581-spec-identity branch September 25, 2026 14:29
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.

Drive galactic-nat shard identity from the EgressShard CRD spec, not env vars

2 participants