Skip to content

Add AuthServerConfigRef CRD field, config model, and JwksAllowPrivateIP#4286

Merged
jhrozek merged 3 commits intomainfrom
vmcp-add-as-scaffolding-1
Mar 24, 2026
Merged

Add AuthServerConfigRef CRD field, config model, and JwksAllowPrivateIP#4286
jhrozek merged 3 commits intomainfrom
vmcp-add-as-scaffolding-1

Conversation

@jhrozek
Copy link
Copy Markdown
Contributor

@jhrozek jhrozek commented Mar 20, 2026

Summary

  • The vMCP embedded authorization server feature (Phase 1: Foundation — add AuthServerConfig model, CRD field, and structural validation #4140) needs CRD and config scaffolding before the runtime can be wired. This PR adds the foundational types and validation without changing any runtime behavior.
  • Add AuthServerConfigRef field to VirtualMCPServerSpec for referencing an MCPExternalAuthConfig with type embeddedAuthServer
  • Add AuthServer field (*authserver.RunConfig) to the vMCP runtime config model
  • Add JwksAllowPrivateIP to OIDCConfig for loopback JWKS fetches when the embedded auth server's OIDC discovery endpoint is on a private address
  • Move ExternalAuthConfigRef to mcpexternalauthconfig_types.go (same package, pure code organization)
  • Add structural validation and condition constants for the new field

Fixes #4140

Type of change

  • New feature

Test plan

  • e2e testing as part of a large branch from which I cherry-picked this PR from

Changes

File Change
cmd/thv-operator/api/v1alpha1/virtualmcpserver_types.go Add AuthServerConfigRef field with godoc, kubebuilder markers, and validation
cmd/thv-operator/api/v1alpha1/virtualmcpserver_types_test.go Table-driven tests for validateAuthServerConfig()
cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_types.go Move ExternalAuthConfigRef here from mcpserver_types.go
cmd/thv-operator/api/v1alpha1/mcpserver_types.go Remove ExternalAuthConfigRef (moved)
pkg/vmcp/config/config.go Add RuntimeConfig.AuthServer and OIDCConfig.JwksAllowPrivateIP
pkg/vmcp/auth/factory/incoming.go OR JwksAllowPrivateIP with ProtectedResourceAllowPrivateIP
Generated files deepcopy, CRD manifests, CRD reference docs

Does this introduce a user-facing change?

No. This adds CRD fields and config types but does not wire them into any runtime code path yet.

Special notes for reviewers

  • JwksAllowPrivateIP is OR'd with ProtectedResourceAllowPrivateIP in the auth factory so that either flag enables private-IP JWKS fetches. This is needed because the embedded auth server runs on a loopback address in-cluster.
  • The AuthServerConfigRef validation only checks structural correctness (non-empty name, correct type). Full semantic validation (e.g., referenced resource exists and is ready) will come in a follow-up controller reconciliation PR.

Generated with Claude Code

Large PR Justification

  • added new fields into CRDs which adds a bunch of autogenerated YAML. The logic in this PR is minimal.

@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Mar 20, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.56%. Comparing base (e735122) to head (4d134f3).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...hv-operator/api/v1alpha1/virtualmcpserver_types.go 80.00% 0 Missing and 2 partials ⚠️
pkg/vmcp/auth/factory/incoming.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4286      +/-   ##
==========================================
- Coverage   68.61%   68.56%   -0.05%     
==========================================
  Files         478      478              
  Lines       48450    48466      +16     
==========================================
- Hits        33243    33233      -10     
- Misses      12367    12379      +12     
- Partials     2840     2854      +14     

☔ 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.

@jhrozek jhrozek force-pushed the vmcp-add-as-scaffolding-1 branch from cdf5325 to d506e3a Compare March 23, 2026 13:58
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 23, 2026
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.

Phase 1 of the vMCP embedded authorization server (#4140):

- Move ExternalAuthConfigRef to mcpexternalauthconfig_types.go
- Add AuthServerConfig *EmbeddedAuthServerConfig to VirtualMCPServerSpec
  for inline embedded auth server configuration (no separate CRD needed)
- Add ConditionTypeAuthServerConfigValidated condition and reasons
- Add validateAuthServerConfig() for issuer and upstream provider checks
- Add RuntimeConfig with AuthServer field (runtime-only, not in CRD)
- Add JwksAllowPrivateIP to OIDCConfig, OR with ProtectedResourceAllowPrivateIP
- Regenerate deepcopy, CRD manifests, and CRD reference docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jhrozek jhrozek force-pushed the vmcp-add-as-scaffolding-1 branch from d506e3a to 7ca7fb4 Compare March 23, 2026 21:27
@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 Mar 23, 2026
@github-actions github-actions bot dismissed their stale review March 23, 2026 21:28

Large PR justification has been provided. Thank you!

@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.

tgrunnagle
tgrunnagle previously approved these changes Mar 23, 2026
Remove extra blank line that caused gci import ordering lint failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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 Mar 23, 2026
tgrunnagle
tgrunnagle previously approved these changes Mar 23, 2026
Update generated CRD YAML and reference docs to match updated
AuthServerConfig description in VirtualMCPServer types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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 Mar 23, 2026
@jhrozek jhrozek merged commit 4838bb4 into main Mar 24, 2026
43 of 44 checks passed
@jhrozek jhrozek deleted the vmcp-add-as-scaffolding-1 branch March 24, 2026 14:54
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.

Phase 1: Foundation — add AuthServerConfig model, CRD field, and structural validation

3 participants