Skip to content

Add Operator CRD Types for Auth Server Redis Storage#3793

Merged
tgrunnagle merged 1 commit intomainfrom
issue_3792_as-crd
Feb 13, 2026
Merged

Add Operator CRD Types for Auth Server Redis Storage#3793
tgrunnagle merged 1 commit intomainfrom
issue_3792_as-crd

Conversation

@tgrunnagle
Copy link
Copy Markdown
Contributor

@tgrunnagle tgrunnagle commented Feb 11, 2026

Closes #3792

Summary

Adds Kubernetes CRD types for configuring Redis storage in the embedded authorization server. This defines the declarative schema that operators will use to configure Redis-backed storage for horizontal scaling, building on the core Redis storage backend (#3628) and integration tests (#3629). The controller and runner integration that consumes these types is tracked separately in #3630.

Changes Made

CRD Types (mcpexternalauthconfig_types.go)

  • Added AuthServerStorageConfig with type field supporting memory (default) and redis backends
  • Added RedisStorageConfig with Sentinel configuration, ACL user authentication, and configurable timeouts (dial, read, write)
  • Added RedisSentinelConfig with masterName, sentinelAddrs (explicit addresses), and sentinelService (Kubernetes Service discovery) — mutually exclusive
  • Added SentinelServiceRef for referencing a Kubernetes Service for Sentinel discovery (name, namespace, port)
  • Added RedisACLUserConfig with SecretKeyRef references for username and password
  • Added Storage field to EmbeddedAuthServerConfig

Validation Webhooks (mcpexternalauthconfig_webhook.go)

  • Added validateStorageConfig enforcing type-specific configuration presence
  • Added validateRedisStorageConfig requiring sentinelConfig and aclUserConfig, plus Go duration format validation for timeout fields
  • Added validateRedisSentinelConfig enforcing exactly one of sentinelAddrs or sentinelService
  • Added validateRedisACLUserConfig requiring both secret references
  • Integrated storage validation into existing validateEmbeddedAuthServer flow

Generated Files

  • Updated zz_generated.deepcopy.go with DeepCopy methods for all new types
  • Updated CRD manifests in deploy/charts/operator-crds/ (both files/ and templates/)

Implementation Details

  • Simplified the issue's proposed design by removing deploymentMode and authType enum fields — since only sentinel and aclUser are supported, these are implicit in the type structure rather than configurable enums
  • Follows existing patterns: SecretKeyRef for secret references, kubebuilder validation annotations for enums and defaults, optional fields with sensible defaults

Testing

  • Added TestMCPExternalAuthConfig_ValidateStorageConfig with 17 test cases covering:
    • Default/explicit memory storage, invalid memory+redis combinations
    • Valid Redis with sentinel addrs and sentinel service ref
    • Missing required fields (sentinel config, master name, ACL config, secret refs)
    • Mutual exclusivity of sentinelAddrs vs sentinelService (both set, neither set)
    • Empty sentinel service name
    • Valid and invalid Go duration timeout strings (dial, read, write)
  • All tests are parallel and use table-driven patterns consistent with existing tests

Additional Notes

Large PR Justification

  • Isolated CRD updates and corresponding webhooks/tests only

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 transformation

Alternative:

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.

@github-actions github-actions Bot added the size/XL Extra large PR: 1000+ lines changed label Feb 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 96.15385% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.83%. Comparing base (f1772c6) to head (f2c27bf).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ator/api/v1alpha1/mcpexternalauthconfig_webhook.go 96.15% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3793      +/-   ##
==========================================
- Coverage   66.84%   66.83%   -0.02%     
==========================================
  Files         439      439              
  Lines       43509    43561      +52     
==========================================
+ Hits        29083    29112      +29     
- Misses      12175    12197      +22     
- Partials     2251     2252       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 11, 2026
@tgrunnagle tgrunnagle marked this pull request as ready for review February 11, 2026 21:55
jhrozek
jhrozek previously approved these changes Feb 11, 2026
Comment thread cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_webhook.go Outdated
Comment thread cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_types.go
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review.

@github-actions github-actions Bot dismissed their stale review February 12, 2026 17:23

Large PR justification has been provided. Thank you!

@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 12, 2026
jhrozek
jhrozek previously approved these changes Feb 12, 2026
@jhrozek
Copy link
Copy Markdown
Contributor

jhrozek commented Feb 12, 2026

Not sure what's up with the CI though..it doesn't seem to be an issue in your PR

@jhrozek
Copy link
Copy Markdown
Contributor

jhrozek commented Feb 13, 2026

@tgrunnagle we worked around the CI failures in #3815 would you mind rebasing atop origin/main? I'll ack the PR right away

Address review feedback

Address feedback

- constants for storage types

Run `task crdref-gen`
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 13, 2026
@tgrunnagle tgrunnagle merged commit 9305d9e into main Feb 13, 2026
36 checks passed
@tgrunnagle tgrunnagle deleted the issue_3792_as-crd branch February 13, 2026 16:35
tgrunnagle added a commit that referenced this pull request Feb 19, 2026
Wires the Redis storage backend through the operator controller and auth server runner, enabling the embedded auth server to use Redis Sentinel for persistent, horizontally-scalable token storage in Kubernetes. This builds on the CRD types (#3793) and core Redis storage implementation (#3628) to complete the end-to-end integration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auth Server: Add Operator CRD Types for Redis Storage

2 participants