Skip to content

Commit 6788d84

Browse files
committed
rebase merge conflicts and fixes from review
1 parent 8fe56dc commit 6788d84

3 files changed

Lines changed: 19 additions & 89 deletions

File tree

cmd/thv-operator/api/v1alpha1/mcpserver_types.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,16 @@ type SecretRef struct {
361361
TargetEnvName string `json:"targetEnvName,omitempty"`
362362
}
363363

364-
// SessionStorageConfig defines session storage configuration for horizontal scaling
364+
// SessionStorageConfig defines session storage configuration for horizontal scaling.
365+
//
366+
// This is the CRD/K8s-aware surface: it uses SecretKeyRef for secret resolution.
367+
// The reconciler resolves PasswordRef to a plain string and builds a
368+
// session.RedisConfig (pkg/transport/session) for the actual storage backend.
369+
//
370+
// TODO: Add a corresponding SessionStorageConfig to pkg/vmcp/config.Config so the
371+
// vMCP process receives session storage config through the existing config injection
372+
// path (same as Optimizer and Audit). The CRD type will remain separate because
373+
// PasswordRef is K8s-specific and gets resolved away before the config-pkg type.
365374
//
366375
// +kubebuilder:validation:XValidation:rule="self.provider == 'redis' ? has(self.address) : true",message="address is required"
367376
type SessionStorageConfig struct {

cmd/thv-operator/api/v1alpha1/virtualmcpserver_types_test.go

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -481,92 +481,6 @@ func TestValidateEmbeddingServer(t *testing.T) {
481481
}
482482
}
483483

484-
func TestValidateAuthServerConfig(t *testing.T) {
485-
t.Parallel()
486-
487-
tests := []struct {
488-
name string
489-
server *VirtualMCPServer
490-
expectError bool
491-
errContains string
492-
}{
493-
{
494-
name: "nil_config_passes",
495-
server: &VirtualMCPServer{
496-
Spec: VirtualMCPServerSpec{
497-
Config: config.Config{Group: "test-group"},
498-
},
499-
},
500-
},
501-
{
502-
name: "valid_config_passes",
503-
server: &VirtualMCPServer{
504-
Spec: VirtualMCPServerSpec{
505-
Config: config.Config{Group: "test-group"},
506-
AuthServerConfig: &EmbeddedAuthServerConfig{
507-
Issuer: "http://localhost:9090",
508-
UpstreamProviders: []UpstreamProviderConfig{
509-
{
510-
Name: "test",
511-
Type: UpstreamProviderTypeOIDC,
512-
OIDCConfig: &OIDCUpstreamConfig{
513-
IssuerURL: "https://accounts.google.com",
514-
ClientID: "test-client",
515-
},
516-
},
517-
},
518-
},
519-
},
520-
},
521-
},
522-
{
523-
name: "empty_issuer_errors",
524-
server: &VirtualMCPServer{
525-
Spec: VirtualMCPServerSpec{
526-
Config: config.Config{Group: "test-group"},
527-
AuthServerConfig: &EmbeddedAuthServerConfig{
528-
Issuer: "",
529-
UpstreamProviders: []UpstreamProviderConfig{
530-
{Name: "test", Type: UpstreamProviderTypeOIDC},
531-
},
532-
},
533-
},
534-
},
535-
expectError: true,
536-
errContains: "spec.authServerConfig.issuer is required",
537-
},
538-
{
539-
name: "no_upstreams_errors",
540-
server: &VirtualMCPServer{
541-
Spec: VirtualMCPServerSpec{
542-
Config: config.Config{Group: "test-group"},
543-
AuthServerConfig: &EmbeddedAuthServerConfig{
544-
Issuer: "http://localhost:9090",
545-
},
546-
},
547-
},
548-
expectError: true,
549-
errContains: "spec.authServerConfig.upstreamProviders is required",
550-
},
551-
}
552-
553-
for _, tt := range tests {
554-
t.Run(tt.name, func(t *testing.T) {
555-
t.Parallel()
556-
557-
err := tt.server.Validate()
558-
if tt.expectError {
559-
require.Error(t, err)
560-
if tt.errContains != "" {
561-
assert.Contains(t, err.Error(), tt.errContains)
562-
}
563-
return
564-
}
565-
require.NoError(t, err)
566-
})
567-
}
568-
}
569-
570484
func TestVirtualMCPServerSpecScalingFieldsJSONRoundtrip(t *testing.T) {
571485
t.Parallel()
572486

@@ -621,4 +535,3 @@ func TestVirtualMCPServerSpecScalingFieldsJSONRoundtrip(t *testing.T) {
621535
})
622536
}
623537
}
624-

docs/operator/crd-api.md

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)