Skip to content

feat(controller): emit ServerReady event when Ready transitions to Available#184

Merged
k8s-ci-robot merged 2 commits into
kubernetes-sigs:mainfrom
ibm-adarsh:emit-events-2
May 18, 2026
Merged

feat(controller): emit ServerReady event when Ready transitions to Available#184
k8s-ci-robot merged 2 commits into
kubernetes-sigs:mainfrom
ibm-adarsh:emit-events-2

Conversation

@ibm-adarsh
Copy link
Copy Markdown
Contributor

Summary

Part of #109 (Kubernetes event coverage).

Emit a Normal Kubernetes event when Ready transitions to True with reason Available, after deployment is healthy and the MCP handshake succeeds. This completes the lifecycle story started in PR #118:

ConfigurationAcceptedServerReady

Uses the same transition-guard pattern as configuration accepted: emit once when Ready was not previously True/Available, not on every reconcile.

Changes

  • Add readyConditionIsAvailable() helper and pendingServerReadyEvent guard at reconcile start
  • Emit event after successful reconcileHandshake() (not when deployment alone becomes available)
  • emitServerReady(): type=Normal, reason=Available, action ServerReady
  • Unit tests for helper, handshake flow, and deduplication

Test plan

  • go test ./internal/controller/... — all specs pass
  • Kind (mcp-lifecycle-dev): new MCPServer shows Valid + Available events
  • Re-reconcile does not emit duplicate Available event
  • Wrong MCP path → MCPEndpointUnavailable, no Available event

Manual verification

image

…able

Emit a Normal Kubernetes event when Ready becomes True with reason
Available after a successful MCP handshake, using the same transition-guard
pattern as Configuration accepted. Part of kubernetes-sigs#109.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for mcp-lifecycle-operator ready!

Name Link
🔨 Latest commit 91b2216
🔍 Latest deploy log https://app.netlify.com/projects/mcp-lifecycle-operator/deploys/6a0ad7a70bfbc900080de677
😎 Deploy Preview https://deploy-preview-184--mcp-lifecycle-operator.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot requested review from aliok and matzew May 18, 2026 05:27
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 18, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @ibm-adarsh. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 18, 2026
if r.Recorder == nil {
return
}
r.Recorder.Eventf(mcpServer, nil, corev1.EventTypeNormal, ReasonAvailable, eventActionServerReady, "%s", "MCPServer is ready; Ready=True")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we perhaps do like this:

r.Recorder.Eventf(mcpServer, nil, corev1.EventTypeNormal, ReasonAvailable, eventActionServerReady, "MCPServer %s is ready; Ready=True", mcpServer.Name)

that way we have the actual name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, Great to have.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE
image

Copy link
Copy Markdown
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 18, 2026
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ibm-adarsh, matzew

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 18, 2026
@k8s-ci-robot k8s-ci-robot merged commit a334dc3 into kubernetes-sigs:main May 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants