@@ -391,7 +391,7 @@ func (r *MCPServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
391391
392392 // Update the MCPServer status with the service URL
393393 if mcpServer .Status .URL == "" {
394- mcpServer .Status .URL = ctrlutil .CreateProxyServiceURL (mcpServer .Name , mcpServer .Namespace , mcpServer .Spec . Port )
394+ mcpServer .Status .URL = ctrlutil .CreateProxyServiceURL (mcpServer .Name , mcpServer .Namespace , mcpServer .GetProxyPort () )
395395 err = r .Status ().Update (ctx , mcpServer )
396396 if err != nil {
397397 ctxLogger .Error (err , "Failed to update MCPServer status" )
@@ -1151,7 +1151,7 @@ func (r *MCPServerReconciler) deploymentForMCPServer(
11511151 VolumeMounts : volumeMounts ,
11521152 Resources : resources ,
11531153 Ports : []corev1.ContainerPort {{
1154- ContainerPort : m .Spec . Port ,
1154+ ContainerPort : m .GetProxyPort () ,
11551155 Name : "http" ,
11561156 Protocol : corev1 .ProtocolTCP ,
11571157 }},
@@ -1228,8 +1228,8 @@ func (r *MCPServerReconciler) serviceForMCPServer(ctx context.Context, m *mcpv1a
12281228 Spec : corev1.ServiceSpec {
12291229 Selector : ls , // Keep original labels for selector
12301230 Ports : []corev1.ServicePort {{
1231- Port : m .Spec . Port ,
1232- TargetPort : intstr .FromInt (int (m .Spec . Port )),
1231+ Port : m .GetProxyPort () ,
1232+ TargetPort : intstr .FromInt (int (m .GetProxyPort () )),
12331233 Protocol : corev1 .ProtocolTCP ,
12341234 Name : "http" ,
12351235 }},
@@ -1383,7 +1383,7 @@ func (r *MCPServerReconciler) deploymentNeedsUpdate(
13831383 }
13841384
13851385 // Check if the port has changed
1386- portArg := fmt .Sprintf ("--proxy-port=%d" , mcpServer .Spec . Port )
1386+ portArg := fmt .Sprintf ("--proxy-port=%d" , mcpServer .GetProxyPort () )
13871387 found = false
13881388 for _ , arg := range container .Args {
13891389 if arg == portArg {
@@ -1414,7 +1414,7 @@ func (r *MCPServerReconciler) deploymentNeedsUpdate(
14141414 }
14151415
14161416 // Check if the container port has changed
1417- if len (container .Ports ) > 0 && container .Ports [0 ].ContainerPort != mcpServer .Spec . Port {
1417+ if len (container .Ports ) > 0 && container .Ports [0 ].ContainerPort != mcpServer .GetProxyPort () {
14181418 return true
14191419 }
14201420
@@ -1535,12 +1535,12 @@ func (r *MCPServerReconciler) deploymentNeedsUpdate(
15351535 return true
15361536 }
15371537
1538- // Check if the targetPort has changed
1539- if mcpServer .Spec .TargetPort != 0 {
1540- targetPortArg := fmt .Sprintf ("--target-port=%d" , mcpServer .Spec .TargetPort )
1538+ // Check if the mcpPort has changed
1539+ if mcpServer .Spec .McpPort != 0 {
1540+ mcpPortArg := fmt .Sprintf ("--target-port=%d" , mcpServer .Spec .McpPort )
15411541 found := false
15421542 for _ , arg := range container .Args {
1543- if arg == targetPortArg {
1543+ if arg == mcpPortArg {
15441544 found = true
15451545 break
15461546 }
@@ -1625,7 +1625,7 @@ func (r *MCPServerReconciler) deploymentNeedsUpdate(
16251625// serviceNeedsUpdate checks if the service needs to be updated
16261626func serviceNeedsUpdate (service * corev1.Service , mcpServer * mcpv1alpha1.MCPServer ) bool {
16271627 // Check if the service port has changed
1628- if len (service .Spec .Ports ) > 0 && service .Spec .Ports [0 ].Port != mcpServer .Spec . Port {
1628+ if len (service .Spec .Ports ) > 0 && service .Spec .Ports [0 ].Port != mcpServer .GetProxyPort () {
16291629 return true
16301630 }
16311631
0 commit comments