@@ -1128,7 +1128,13 @@ func countBackendHealth(ctx context.Context, backends []mcpv1alpha1.DiscoveredBa
11281128 return ready , unhealthy
11291129}
11301130
1131- // determineStatusFromBackends evaluates backend health to determine status
1131+ // determineStatusFromBackends evaluates backend health to determine status.
1132+ // Backend health is based on:
1133+ // - Workload phase (MCPServer/MCPRemoteProxy phase): Always evaluated
1134+ // - Runtime health checks: Only when health monitoring is configured
1135+ //
1136+ // When health monitoring is disabled, backends with healthy workload phase are marked as Ready.
1137+ // When health monitoring is enabled, backends must pass both workload phase checks and runtime health checks.
11321138func (* VirtualMCPServerReconciler ) determineStatusFromBackends (
11331139 ctx context.Context ,
11341140 vmcp * mcpv1alpha1.VirtualMCPServer ,
@@ -1640,6 +1646,11 @@ func (r *VirtualMCPServerReconciler) discoverBackends(
16401646 discoveredBackends := make ([]mcpv1alpha1.DiscoveredBackend , 0 , len (typedWorkloads ))
16411647 now := metav1 .Now ()
16421648
1649+ // Check if health monitoring is enabled for this VirtualMCPServer
1650+ healthMonitoringEnabled := vmcp .Spec .Operational != nil &&
1651+ vmcp .Spec .Operational .FailureHandling != nil &&
1652+ vmcp .Spec .Operational .FailureHandling .HealthCheckInterval != ""
1653+
16431654 // Convert vmcp.Backend to DiscoveredBackend for all workloads in the group
16441655 for _ , workloadInfo := range typedWorkloads {
16451656 backend , found := discoveredBackendMap [workloadInfo .Name ]
@@ -1674,6 +1685,13 @@ func (r *VirtualMCPServerReconciler) discoverBackends(
16741685 ctxLogger .V (1 ).Info ("Backend MCPServer not ready, marking as unavailable" ,
16751686 "name" , workloadInfo .Name ,
16761687 "phase" , mcpServer .Status .Phase )
1688+ } else if backendStatus == mcpv1alpha1 .BackendStatusUnknown && ! healthMonitoringEnabled {
1689+ // When health monitoring is disabled and workload phase is healthy,
1690+ // treat unknown health status as ready (no runtime health checks configured)
1691+ backendStatus = mcpv1alpha1 .BackendStatusReady
1692+ ctxLogger .V (1 ).Info ("Health monitoring disabled with healthy phase, marking backend as ready" ,
1693+ "name" , workloadInfo .Name ,
1694+ "phase" , mcpServer .Status .Phase )
16771695 }
16781696 }
16791697 case workloads .WorkloadTypeMCPRemoteProxy :
@@ -1688,6 +1706,13 @@ func (r *VirtualMCPServerReconciler) discoverBackends(
16881706 ctxLogger .V (1 ).Info ("Backend MCPRemoteProxy not ready, marking as unavailable" ,
16891707 "name" , workloadInfo .Name ,
16901708 "phase" , mcpRemoteProxy .Status .Phase )
1709+ } else if backendStatus == mcpv1alpha1 .BackendStatusUnknown && ! healthMonitoringEnabled {
1710+ // When health monitoring is disabled and workload phase is healthy,
1711+ // treat unknown health status as ready (no runtime health checks configured)
1712+ backendStatus = mcpv1alpha1 .BackendStatusReady
1713+ ctxLogger .V (1 ).Info ("Health monitoring disabled with healthy phase, marking backend as ready" ,
1714+ "name" , workloadInfo .Name ,
1715+ "phase" , mcpRemoteProxy .Status .Phase )
16911716 }
16921717 }
16931718 }
@@ -1715,14 +1740,11 @@ func (r *VirtualMCPServerReconciler) discoverBackends(
17151740 // Performance: Health status responses are cached with healthStatusCacheTTL to reduce HTTP
17161741 // overhead from frequent reconciliations while maintaining relatively fresh health data.
17171742 // The vmcp health endpoint itself returns cached results from periodic health checks.
1718- if vmcp .Status .URL != "" {
1743+ if vmcp .Status .URL != "" && healthMonitoringEnabled {
17191744 // Parse health check interval from spec to derive query timeout
17201745 var healthCheckInterval time.Duration
1721- if vmcp .Spec .Operational != nil && vmcp .Spec .Operational .FailureHandling != nil &&
1722- vmcp .Spec .Operational .FailureHandling .HealthCheckInterval != "" {
1723- if interval , err := time .ParseDuration (vmcp .Spec .Operational .FailureHandling .HealthCheckInterval ); err == nil {
1724- healthCheckInterval = interval
1725- }
1746+ if interval , err := time .ParseDuration (vmcp .Spec .Operational .FailureHandling .HealthCheckInterval ); err == nil {
1747+ healthCheckInterval = interval
17261748 }
17271749
17281750 healthStatus := r .queryVMCPHealthStatus (ctx , vmcp .Status .URL , healthCheckInterval )
0 commit comments