Skip to content

Commit e692beb

Browse files
committed
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 <tmohanvamsi@gmail.com>
1 parent a5240a6 commit e692beb

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

api/v1alpha1/mcpserver_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,14 @@ type HTTPTransportTLS struct {
196196

197197
// MCPServerStatus defines the observed state of MCPServer.
198198
type MCPServerStatus struct {
199+
// DisplayStatus shows a human-readable status of the MCPServer.
200+
// Possible values: "Not Ready", "Ready", "Deleting"
201+
// +optional
202+
DisplayStatus string `json:"displayStatus,omitempty"`
203+
199204
// Conditions describe the current conditions of the MCPServer.
200205
// Implementations should prefer to express MCPServer conditions
201-
// using the `MCPServerConditionType` and `MCPServerConditionReason`
206+
// using the MCPServerConditionType and MCPServerConditionReason
202207
// constants so that operators and tools can converge on a common
203208
// vocabulary to describe MCPServer state.
204209
//
@@ -398,6 +403,7 @@ type ServiceAccountConfig struct {
398403
// +kubebuilder:object:root=true
399404
// +kubebuilder:subresource:status
400405
// +kubebuilder:resource:shortName=mcps;mcp
406+
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.displayStatus"
401407
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
402408
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
403409
// +kubebuilder:resource:categories=kagent

pkg/controller/mcpserver_controller.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,25 @@ func (r *MCPServerReconciler) reconcileStatus(
198198
}
199199
}
200200

201+
// Set human-readable DisplayStatus based on deletion timestamp and Ready condition
202+
if !server.DeletionTimestamp.IsZero() {
203+
server.Status.DisplayStatus = "Deleting"
204+
} else {
205+
readyCondition := false
206+
for _, condition := range server.Status.Conditions {
207+
if condition.Type == string(kagentdevv1alpha1.MCPServerConditionReady) &&
208+
condition.Status == metav1.ConditionTrue {
209+
readyCondition = true
210+
break
211+
}
212+
}
213+
if readyCondition {
214+
server.Status.DisplayStatus = "Ready"
215+
} else {
216+
server.Status.DisplayStatus = "Not Ready"
217+
}
218+
}
219+
201220
// Update the status
202221
if err := r.Status().Update(ctx, server); err != nil {
203222
log.FromContext(ctx).Error(err, "Failed to update MCPServer status")

0 commit comments

Comments
 (0)