From 590d13e7f168dc5c62b2eb6fa661a83a350144f0 Mon Sep 17 00:00:00 2001 From: tadepmo Date: Thu, 23 Apr 2026 18:17:11 -0500 Subject: [PATCH] fix(controller): show correct status for MCPServer resource Add DisplayStatus field to MCPServerStatus to show human-readable status during pod creation and deletion, consistent with how Agent resources behave in kagent. - Add DisplayStatus field to MCPServerStatus struct - Add Status print column to kubectl get mcpserver output - Set 'Not Ready' status while pod is being created - Set 'Deleting' status while resource is being deleted - Set 'Ready' status when deployment is fully available Fixes #68 Signed-off-by: Mohan Vamsi Tadepalli Signed-off-by: tadepmo --- api/v1alpha1/mcpserver_types.go | 8 +++++++- pkg/controller/mcpserver_controller.go | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/api/v1alpha1/mcpserver_types.go b/api/v1alpha1/mcpserver_types.go index 95570e1..1d82c3c 100644 --- a/api/v1alpha1/mcpserver_types.go +++ b/api/v1alpha1/mcpserver_types.go @@ -196,9 +196,14 @@ type HTTPTransportTLS struct { // MCPServerStatus defines the observed state of MCPServer. type MCPServerStatus struct { + // DisplayStatus shows a human-readable status of the MCPServer. + // Possible values: "Not Ready", "Ready", "Deleting" + // +optional + DisplayStatus string `json:"displayStatus,omitempty"` + // Conditions describe the current conditions of the MCPServer. // Implementations should prefer to express MCPServer conditions - // using the `MCPServerConditionType` and `MCPServerConditionReason` + // using the MCPServerConditionType and MCPServerConditionReason // constants so that operators and tools can converge on a common // vocabulary to describe MCPServer state. // @@ -398,6 +403,7 @@ type ServiceAccountConfig struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:shortName=mcps;mcp +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.displayStatus" // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:resource:categories=kagent diff --git a/pkg/controller/mcpserver_controller.go b/pkg/controller/mcpserver_controller.go index 12fd8a6..dac42b6 100644 --- a/pkg/controller/mcpserver_controller.go +++ b/pkg/controller/mcpserver_controller.go @@ -198,6 +198,25 @@ func (r *MCPServerReconciler) reconcileStatus( } } + // Set human-readable DisplayStatus based on deletion timestamp and Ready condition + if !server.DeletionTimestamp.IsZero() { + server.Status.DisplayStatus = "Deleting" + } else { + readyCondition := false + for _, condition := range server.Status.Conditions { + if condition.Type == string(kagentdevv1alpha1.MCPServerConditionReady) && + condition.Status == metav1.ConditionTrue { + readyCondition = true + break + } + } + if readyCondition { + server.Status.DisplayStatus = "Ready" + } else { + server.Status.DisplayStatus = "Not Ready" + } + } + // Update the status if err := r.Status().Update(ctx, server); err != nil { log.FromContext(ctx).Error(err, "Failed to update MCPServer status")