Expand gateway portal peer lifecycle and reinforce healthchecks#162
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
GatewayHandler:gateway_reachable,nft_table_exists,path_exists,peer_endpoint_reachable, andreapply_peer_routingfor reachability checks and reloading persisted peer rule files.GatewayPortalHandlerto replace the single-output healthcheck with a multi-check health routine that validates gateway exec reachability, the internet nftables table (when applicable), per-peer nftables tables, trust-anchor file presence, CoreDNS stub presence, and best-effort peer endpoint probes; health metadata is recorded intogateway_portal_output["healthchecks"].GatewayPortalHandler:add_peer,update_peer,remove_peer,rotate_trust_anchor, andreapply_routing_after_gateway_restart, and updated_apply_cross_worldto useadd_peer._setup_peerto build a persistentartifactdescribing installed peer artifacts (nft table name, routing rules path, dns zone/forwarder, trust anchor path, timestamps), persistpeer_artifactsintocontext.runtime_state.gateway_portal_output, and perform rollback via_rollback_peer_setupwhen later steps fail after earlier ones succeeded._remove_peer_dns,_corefile_contains_stub) and artifact helpers (_safe_peer_name,_trust_anchor_path,_upsert_peer_artifact,_drop_peer_artifact).docs/support-matrix.mdanddocs/spec-alpha-support.mdto mark implemented pieces asexperimentaland describe caveats.tests/test_gateway_portal.pyto cover lifecycle operations, rollback behavior, artifact tracking, healthcheck verification, and routing reapply; existing cross-world unit tests were adjusted to align with the new behaviors.Testing
ruffformatting andruff checkon modified files and fixed linter issues, with checks passing.pytest -q tests/test_gateway_portal.py tests/test_gateway_federation.py, with all tests passing (50 passed, 8 warnings).Codex Task