Skip to content

feat: every overlay peer gets PersistentKeepalive = 25 (keel#140) - #144

Open
marcos-mendez wants to merge 1 commit into
mainfrom
feat/mesh-keepalive
Open

marcos-mendez wants to merge 1 commit into
mainfrom
feat/mesh-keepalive

Conversation

@marcos-mendez

Copy link
Copy Markdown
Collaborator

Follow-up of #143 for #140. Decision: the coordinator's, 2026-10-10. Turn on PersistentKeepalive = 25 for every mesh peer, so that the 180 s handshake drift means "unreachable" and the NAT/firewall state stays open between sites.

Change

  • keel/network/wireguard.py: DEFAULT_KEEPALIVE = 25 and keepalive(). render writes PersistentKeepalive for every peer: the spec's value, else 25.
  • keel/network/switch.py (keepalive_only): keel spec apply sets the keepalive live with wg set. A change that only sets the keepalive of a peer that the interface holds cannot cut the node off, so it counts as an addition does (added_live, keel#117). keel mesh keeps it with no handshake, so the first sync after the upgrade does not wait for one.
  • keel/diff/compare.py (with_overlay_defaults): a peer that gives no keepalive declares 25. A file written before this version is drift (network.overlay.wireguard.peers.<key>.persistent_keepalive) until apply writes it again.
  • Docs: docs/spec.md, docs/diff.md, docs/apply.md. Version 0.23.17 (fix: the old primary turns its database read only before it releases the VIP (keel#138) #142 holds 0.23.16).

Tests

  • tests/test_network_wireguard.py: render and the default.
  • tests/test_inspect_overlay.py: keel diff says same for a file with the line, and drift for a file without it.
  • tests/test_network_overlay_live.py: a change that only sets the keepalive counts as safe; an endpoint change does not.
  • The mesh netns suites (3-node, 4-node, late-add, live-peers) pass locally.

The coordinator's decision of 2026-10-10 on keel#140: a last handshake
older than 180 s is drift and means the member is unreachable only when
each peer sends a keepalive, and a keepalive keeps the NAT and firewall
state open between sites.

- keel.network.wireguard renders PersistentKeepalive = 25 for every peer
  whose spec gives none (DEFAULT_KEEPALIVE, keepalive()).
- keel spec apply sets it live with wg set. A change that only sets the
  keepalive of a peer the interface holds cannot cut the node off, as
  an addition cannot (keel#117), so keel mesh keeps it with no
  handshake and the first sync after the upgrade waits for nothing.
- keel diff takes 25 as the declared keepalive of a peer that gives
  none: a file written before is drift until apply writes it again.
- docs/spec.md, docs/diff.md, docs/apply.md.

Tests: the render, the default in keel diff (same, and drift for a file
without the line), the keepalive-only change kept as safe; the mesh
netns suites pass with it.

Version 0.23.17 (#142 holds 0.23.16).
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.

1 participant