Skip to content

Commit d67c7c7

Browse files
committed
Root cause: The TLS commit changed the MCP service port from 8080 to 8443
when TLS is enabled. This broke existing clients (like the OpenStackAssistant's Goose extension) that have the http://...:8080 URL configured. Fix: Keep port 8080 for both TLS and non-TLS modes. TLS doesn't require a different port — the MCP server can serve HTTPS on 8080. Changes in three places: 1. internal/openstackclient/funcs.go — removed the container port change (always 8080) and removed the port change in MCPConfigYAML (always port: 8080) 2. internal/controller/client/openstackclient_controller.go — removed the service port change (always 8080) The TLS cert/key mounting, TLS config in the YAML, and https allowed origins are all still in place — only the port change was removed.
1 parent d58b1e6 commit d67c7c7

2 files changed

Lines changed: 5 additions & 15 deletions

File tree

internal/controller/client/openstackclient_controller.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,6 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
385385

386386
// Reconcile MCP Service after configVarsHash so the hash annotation captures all config changes
387387
if instance.Spec.MCP != nil && instance.Spec.MCP.Enabled {
388-
mcpTLSEnabled := instance.Spec.CaBundleSecretName != ""
389-
mcpPort := int32(8080)
390-
if mcpTLSEnabled {
391-
mcpPort = 8443
392-
}
393-
394388
mcpService := &corev1.Service{
395389
ObjectMeta: metav1.ObjectMeta{
396390
Name: instance.Name + "-mcp",
@@ -400,7 +394,7 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
400394
mcpServiceHash, err := util.ObjectHash(map[string]interface{}{
401395
"containerImage": instance.Spec.ContainerImage,
402396
"mcpContainerImage": instance.Spec.MCP.ContainerImage,
403-
"mcpConfig": openstackclient.MCPConfigYAML(instance.Spec.CaBundleSecretName, mcpTLSEnabled),
397+
"mcpConfig": openstackclient.MCPConfigYAML(instance.Spec.CaBundleSecretName, instance.Spec.CaBundleSecretName != ""),
404398
"configVarsHash": configVarsHash,
405399
})
406400
if err != nil {
@@ -415,7 +409,7 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
415409
mcpService.Spec.Ports = []corev1.ServicePort{
416410
{
417411
Name: "mcp",
418-
Port: mcpPort,
412+
Port: 8080,
419413
Protocol: corev1.ProtocolTCP,
420414
},
421415
}

internal/openstackclient/funcs.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ func ClientPodSpec(
136136
mcpVolumeMounts = append(mcpVolumeMounts, instance.Spec.CreateVolumeMounts(nil)...)
137137
}
138138

139-
mcpPort := int32(8080)
140139
if mcpTLSSecretName != "" {
141-
mcpPort = 8443
142140
mcpVolumeMounts = append(mcpVolumeMounts, corev1.VolumeMount{
143141
Name: "mcp-tls",
144142
MountPath: "/etc/pki/tls/mcp",
@@ -184,7 +182,7 @@ func ClientPodSpec(
184182
Command: []string{"rhos-ls-mcps"},
185183
Env: mcpEnvVars,
186184
Ports: []corev1.ContainerPort{
187-
{Name: "mcp", ContainerPort: mcpPort, Protocol: corev1.ProtocolTCP},
185+
{Name: "mcp", ContainerPort: 8080, Protocol: corev1.ProtocolTCP},
188186
},
189187
SecurityContext: &corev1.SecurityContext{
190188
RunAsUser: ptr.To[int64](42401),
@@ -212,18 +210,16 @@ func MCPConfigYAML(caBundleSecretName string, tlsEnabled bool) string {
212210
if caBundleSecretName != "" {
213211
caCert = fmt.Sprintf("\n ca_cert: %s", tls.DownstreamTLSCABundlePath)
214212
}
215-
port := "8080"
216213
tlsConfig := ""
217214
allowedOriginScheme := "http"
218215
if tlsEnabled {
219-
port = "8443"
220216
tlsConfig = `
221217
tls:
222218
cert_file: /etc/pki/tls/mcp/tls.crt
223219
key_file: /etc/pki/tls/mcp/tls.key`
224220
allowedOriginScheme = "https"
225221
}
226-
return fmt.Sprintf(`port: %s
222+
return fmt.Sprintf(`port: 8080
227223
openstack:
228224
enabled: true
229225
allow_write: false%s
@@ -235,7 +231,7 @@ mcp_transport_security:
235231
- "*:*"
236232
allowed_origins:
237233
- "%s://*:*"
238-
`, port, caCert, tlsConfig, allowedOriginScheme)
234+
`, caCert, tlsConfig, allowedOriginScheme)
239235
}
240236

241237
func clientPodVolumeMounts() []corev1.VolumeMount {

0 commit comments

Comments
 (0)