feat(gateway): add stateless gateway proxy mode#123
Merged
Conversation
…uting Implement a stateless gateway proxy that routes client gRPC requests to the correct backend cluster node without participating in Raft consensus. - 11 service proxies: KV, Cluster, Maintenance, Watch, Lease, Lock, Election, Barrier, Queue, Session, Auth - Auth token forwarding via metadata preservation - TLS support for backend connections (--tls-ca, --tls-cert, --tls-key) - Request timeout with configurable --request-timeout-ms - Leader redirect detection with automatic retry and connection caching - O(1) round-robin load balancing via Vec + AtomicUsize - Leader discovery on startup via MemberList RPC - Health check HTTP endpoint (/health/live, /health/ready) - CLI: --gateway, --backends, --health-addr - Streaming proxy support: Watch, Lease KeepAlive, Session KeepAlive (bidirectional), Election Observe (server streaming)
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.
Summary
Add a stateless gateway proxy that routes client gRPC requests to the correct backend cluster node without participating in Raft consensus. Clients connect to the gateway instead of directly to cluster nodes.
Changes
BackendPoolwith Vec-based O(1) round-robin, leader discovery, TLS channel creation, auth forwarding helper, health check HTTP server, redirect connection caching.pub mod gateway.--gateway,--backends,--request-timeout-ms,--tls-ca/cert/key,--health-addr. Gateway mode entry point.tonictls-ringfeature.Key design
authorizationmetadata preserved from client to backend.--tls-ca/cert/key.GET /health/live(always OK),GET /health/ready(at least one backend reachable).x-aether-leaderredirect header, update leader tracking, cache new connection, retry.Testing
cargo build— 0 warningscargo clippy -- -D warnings— 0 errorscargo fmt -- --check— cleancargo test --lib— 170 passed, 0 failedHow to verify
Related issues
Refs #94