Draft
Conversation
Contributor
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3639 +/- ##
==========================================
+ Coverage 65.86% 66.03% +0.17%
==========================================
Files 413 415 +2
Lines 40953 41623 +670
==========================================
+ Hits 26974 27487 +513
- Misses 11891 11985 +94
- Partials 2088 2151 +63 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Implement RedisStorage that satisfies the Storage interface to enable horizontal scaling of ToolHive auth servers. Multiple instances can now share authentication state via Redis with automatic Sentinel failover. Key features: - Redis Sentinel support for high availability deployments - ACL user authentication with credentials from environment variables - Multi-tenant key prefix with hash tags for Redis cluster slot co-location - Secondary indexes for RFC 7009 token revocation compliance - Automatic expiration via Redis TTL instead of background cleanup - Health checking via Redis PING New files: - pkg/authserver/storage/redis.go - Full Storage interface implementation - pkg/authserver/storage/redis_keys.go - Key generation utilities - pkg/authserver/storage/redis_test.go - Unit tests with miniredis (85% coverage) Dependencies added: - github.com/redis/go-redis/v9 - github.com/alicebob/miniredis/v2 (testing) Closes #3628 Address internal feedback Address internal review feedback Expire public clients
c0e32f5 to
ac645ba
Compare
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.
Closes #3628
Summary
Implements a Redis Sentinel-backed storage backend for the authorization server's
Storageinterface, enabling horizontal scaling of ToolHive auth servers. Multiple instances can now share authentication state via Redis with automatic failover support. This is Phase 1 of the Redis Storage feature, providing the core implementation with comprehensive unit tests.Changes Made
Storage Backend (
pkg/authserver/storage/)RedisStoragestruct implementing all 30+ methods of theStorageinterfacestoredSession,storedClient,storedProviderIdentity, etc.) for JSON storageUpdateProviderIdentityLastUsedoperation to prevent race conditionsKey Generation (
pkg/authserver/storage/redis_keys.go)DeriveKeyPrefixfunction using hash tag formatthv:auth:{ns:name}:for Redis Cluster slot co-locationConfiguration (
pkg/authserver/storage/config.go)TypeRedisstorage type constantRedisRunConfigand related types for serializable configuration (Sentinel addresses, ACL credentials, timeouts)Dependencies (
go.mod)github.com/redis/go-redis/v9for Redis client with Sentinel supportgithub.com/alicebob/miniredis/v2for unit testingImplementation Details
{ns:name}combines namespace and name to ensure all keys for a server land in the same Redis Cluster sloturl.Valuesstored asmap[string][]string)Testing
Additional Notes