Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cmd/thv-operator/api/v1alpha1/mcpserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ type MCPServerSpec struct {
// +kubebuilder:default=8080
ProxyPort int32 `json:"proxyPort,omitempty"`

// McpPort is the port that MCP server listens to
// MCPPort is the port that MCP server listens to
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// +optional
McpPort int32 `json:"mcpPort,omitempty"`
MCPPort int32 `json:"mcpPort,omitempty"`

// Args are additional arguments to pass to the MCP server
// +listType=atomic
Expand Down Expand Up @@ -1149,10 +1149,10 @@ func (m *MCPServer) GetProxyPort() int32 {
return 8080
}

// GetMcpPort returns the MCP port of the MCPServer
func (m *MCPServer) GetMcpPort() int32 {
if m.Spec.McpPort > 0 {
return m.Spec.McpPort
// GetMCPPort returns the MCP port of the MCPServer
func (m *MCPServer) GetMCPPort() int32 {
if m.Spec.MCPPort > 0 {
return m.Spec.MCPPort
}
return 8080
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/thv-operator/controllers/mcpserver_runconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (r *MCPServerReconciler) createRunConfigFromMCPServer(m *mcpv1alpha1.MCPSer
runner.WithName(m.Name),
runner.WithImage(m.Spec.Image),
runner.WithCmdArgs(m.Spec.Args),
runner.WithTransportAndPorts(m.Spec.Transport, int(m.GetProxyPort()), int(m.GetMcpPort())),
runner.WithTransportAndPorts(m.Spec.Transport, int(m.GetProxyPort()), int(m.GetMCPPort())),
runner.WithProxyMode(transporttypes.ProxyMode(effectiveProxyMode)),
runner.WithHost(proxyHost),
runner.WithTrustProxyHeaders(m.Spec.TrustProxyHeaders),
Expand Down
14 changes: 7 additions & 7 deletions cmd/thv-operator/controllers/mcpserver_runconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func TestCreateRunConfigFromMCPServer(t *testing.T) {
Image: testImage,
Transport: "sse",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
// ProxyMode set to streamable-http (should be ignored and set to "sse")
ProxyMode: streamableHTTPProxyMode,
},
Expand All @@ -249,7 +249,7 @@ func TestCreateRunConfigFromMCPServer(t *testing.T) {
Image: testImage,
Transport: "sse",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
// ProxyMode not specified
},
},
Expand All @@ -272,7 +272,7 @@ func TestCreateRunConfigFromMCPServer(t *testing.T) {
Image: testImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
// ProxyMode set to sse (should be ignored and set to "streamable-http")
ProxyMode: sseProxyMode,
},
Expand All @@ -296,7 +296,7 @@ func TestCreateRunConfigFromMCPServer(t *testing.T) {
Image: testImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
// ProxyMode not specified
},
},
Expand All @@ -319,7 +319,7 @@ func TestCreateRunConfigFromMCPServer(t *testing.T) {
Image: "comprehensive:latest",
Transport: "streamable-http",
ProxyPort: 9090,
McpPort: 8080,
MCPPort: 8080,
ProxyMode: "streamable-http",
Args: []string{"--comprehensive", "--test"},
Env: []mcpv1alpha1.EnvVar{
Expand Down Expand Up @@ -609,7 +609,7 @@ func TestDeterministicConfigMapGeneration(t *testing.T) {
Image: "deterministic-test:v1.2.3",
Transport: "sse",
ProxyPort: 9090,
McpPort: 8080,
MCPPort: 8080,
Args: []string{"--arg1", "--arg2", "--complex-flag=value"},
Env: []mcpv1alpha1.EnvVar{
{Name: "VAR_C", Value: "value_c"},
Expand Down Expand Up @@ -1416,7 +1416,7 @@ func TestMCPServerModificationScenarios(t *testing.T) {
modifyServer: func(server *mcpv1alpha1.MCPServer) {
server.Spec.Transport = "sse"
server.Spec.ProxyPort = 9090
server.Spec.McpPort = 8080
server.Spec.MCPPort = 8080
},
expectedChanges: map[string]interface{}{
"Transport": transporttypes.TransportTypeSSE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var _ = Describe("MCPServer Controller Integration Tests", func() {
Transport: "stdio",
ProxyMode: "sse",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Args: []string{"--verbose"},
Env: []mcpv1alpha1.EnvVar{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var _ = Describe("RunConfig ConfigMap Integration Tests", func() {
Transport: "stdio",
ProxyMode: "sse",
ProxyPort: 8080,
McpPort: 8081,
MCPPort: 8081,
Args: []string{"--verbose", "--debug"},
Env: []mcpv1alpha1.EnvVar{
{
Expand Down Expand Up @@ -775,7 +775,7 @@ var _ = Describe("RunConfig ConfigMap Integration Tests", func() {
Image: "deterministic/mcp-server:v1.0.0",
Transport: "sse",
ProxyPort: 9090,
McpPort: 8080,
MCPPort: 8080,
Args: []string{"--arg1", "--arg2", "--arg3"},
Env: []mcpv1alpha1.EnvVar{
{Name: "VAR_C", Value: "value_c"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ spec:
description: Image is the container image for the MCP server
type: string
mcpPort:
description: McpPort is the port that MCP server listens to
description: MCPPort is the port that MCP server listens to
format: int32
maximum: 65535
minimum: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ spec:
description: Image is the container image for the MCP server
type: string
mcpPort:
description: McpPort is the port that MCP server listens to
description: MCPPort is the port that MCP server listens to
format: int32
maximum: 65535
minimum: 1
Expand Down
2 changes: 1 addition & 1 deletion docs/operator/crd-api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/export/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func runConfigToMCPServer(config *runner.RunConfig) (*v1alpha1.MCPServer, error)
// Set target port if specified
if config.TargetPort > 0 {
// #nosec G115 -- Port values are validated elsewhere, safe conversion
mcpServer.Spec.McpPort = int32(config.TargetPort)
mcpServer.Spec.MCPPort = int32(config.TargetPort)
}

// Set proxy mode if transport is stdio
Expand Down
2 changes: 1 addition & 1 deletion pkg/export/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestWriteK8sManifest(t *testing.T) {
t.Helper()
assert.Equal(t, "sse", mcpServer.Spec.Transport)
assert.Equal(t, int32(8081), mcpServer.GetProxyPort())
assert.Equal(t, int32(3000), mcpServer.GetMcpPort())
assert.Equal(t, int32(3000), mcpServer.GetMCPPort())
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/thv-operator/acceptance_tests/ratelimit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var _ = Describe("MCPServer Rate Limiting", Ordered, func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand Down Expand Up @@ -141,7 +141,7 @@ var _ = Describe("MCPServer Rate Limiting", Ordered, func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/thv-operator/virtualmcp/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func CreateMCPServerAndWait(
Image: image,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Resources: defaultMCPServerResources(),
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
Expand Down Expand Up @@ -761,7 +761,7 @@ func CreateMultipleMCPServersInParallel(
Image: backends[idx].Image,
Transport: backendTransport,
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
ExternalAuthConfigRef: backends[idx].ExternalAuthConfigRef,
Secrets: backends[idx].Secrets,
Resources: resources,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/thv-operator/virtualmcp/mcpserver_scaling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ var _ = ginkgo.Describe("MCPServer Cross-Replica Session Routing with Redis", fu
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: proxyPort,
McpPort: 8080,
MCPPort: 8080,
Replicas: &replicas,
BackendReplicas: &backendReplicas,
SessionAffinity: "None",
Expand Down Expand Up @@ -386,7 +386,7 @@ var _ = ginkgo.Describe("MCPServer Cross-Replica Session Routing with Redis", fu
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: proxyPort,
McpPort: 8080,
MCPPort: 8080,
Replicas: &replicas,
SessionAffinity: "None",
SessionStorage: &mcpv1alpha1.SessionStorageConfig{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ var _ = Describe("Auth Config Error Handling", Ordered, func() {
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
ExternalAuthConfigRef: &mcpv1alpha1.ExternalAuthConfigRef{
Name: workingAuthConfigName,
},
Expand All @@ -1472,7 +1472,7 @@ var _ = Describe("Auth Config Error Handling", Ordered, func() {
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
// Reference a non-existent auth config to trigger error
ExternalAuthConfigRef: &mcpv1alpha1.ExternalAuthConfigRef{
Name: missingAuthConfigName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var _ = Describe("VirtualMCPServer Circuit Breaker Lifecycle", Ordered, func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand All @@ -75,7 +75,7 @@ var _ = Describe("VirtualMCPServer Circuit Breaker Lifecycle", Ordered, func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("VirtualMCPServer Discovered Mode", Ordered, func() {
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
},
}
Expect(k8sClient.Create(ctx, backend1)).To(Succeed())
Expand All @@ -75,7 +75,7 @@ var _ = Describe("VirtualMCPServer Discovered Mode", Ordered, func() {
Image: images.OSVMCPServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
},
}
Expect(k8sClient.Create(ctx, backend2)).To(Succeed())
Expand Down Expand Up @@ -482,7 +482,7 @@ var _ = Describe("VirtualMCPServer Discovered Mode", Ordered, func() {
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
},
}
Expect(k8sClient.Create(ctx, backend3)).To(Succeed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var _ = Describe("VirtualMCPServer Unauthenticated Backend Auth", Ordered, func(
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
// Reference the unauthenticated external auth config
ExternalAuthConfigRef: &mcpv1alpha1.ExternalAuthConfigRef{
Name: externalAuthConfigName,
Expand Down Expand Up @@ -244,7 +244,7 @@ var _ = Describe("VirtualMCPServer Inline Unauthenticated Backend Auth", Ordered
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
},
}
Expect(k8sClient.Create(ctx, backend)).To(Succeed())
Expand Down Expand Up @@ -420,7 +420,7 @@ var _ = Describe("VirtualMCPServer HeaderInjection Backend Auth", Ordered, func(
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
// Reference the headerInjection external auth config
ExternalAuthConfigRef: &mcpv1alpha1.ExternalAuthConfigRef{
Name: externalAuthConfigName,
Expand Down Expand Up @@ -643,7 +643,7 @@ var _ = Describe("VirtualMCPServer Inline HeaderInjection Backend Auth", Ordered
Image: images.GofetchServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
},
}
Expect(k8sClient.Create(ctx, backend)).To(Succeed())
Expand Down Expand Up @@ -834,7 +834,7 @@ var _ = Describe("VirtualMCPServer Health Check with HeaderInjection Auth", Orde
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand Down Expand Up @@ -1050,7 +1050,7 @@ var _ = Describe("VirtualMCPServer Health Check with TokenExchange Auth", Ordere
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var _ = ginkgo.Describe("VirtualMCPServer Session Management", func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
},
})).To(gomega.Succeed())

Expand Down Expand Up @@ -445,7 +445,7 @@ var _ = ginkgo.Describe("VirtualMCPServer Session Management", func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
},
})).To(gomega.Succeed())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe("VirtualMCPServer Telemetry Config", Ordered, func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var _ = Describe("VirtualMCPServer Yardstick Base", Ordered, func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand All @@ -68,7 +68,7 @@ var _ = Describe("VirtualMCPServer Yardstick Base", Ordered, func() {
Image: images.YardstickServerImage,
Transport: "streamable-http",
ProxyPort: 8080,
McpPort: 8080,
MCPPort: 8080,
Env: []mcpv1alpha1.EnvVar{
{Name: "TRANSPORT", Value: "streamable-http"},
},
Expand Down
Loading
Loading