Skip to content

feat(ctl): add kmeshctl namespace list command for mesh discovery - #1921

Draft
devGPP23 wants to merge 1 commit into
kmesh-net:mainfrom
devGPP23:feat/mcp-namespace-list
Draft

devGPP23 wants to merge 1 commit into
kmesh-net:mainfrom
devGPP23:feat/mcp-namespace-list

Conversation

@devGPP23

@devGPP23 devGPP23 commented Aug 14, 2026

Copy link
Copy Markdown

Problem

While looking into the requirements for the upcoming MCP server implementation (Issue #1800), I noticed that we needed a way to retrieve all mesh namespaces (specifically for Tool #10: get_mesh_namespaces). However, there was no native CLI command available to list the namespaces that are actively enrolled in Kmesh, forcing users to rely on manual kubectl queries.

If a user tried to query namespaces via the CLI, it just failed:

$ kmeshctl namespace list
Error: unknown command "namespace" for "kmeshctl"
Run 'kmeshctl --help' for usage.

$ kubectl get namespace -l istio.io/dataplane-mode=Kmesh
NAME            STATUS   AGE
default         Active   10d
bookinfo        Active   2d

Solution
I added a new kmeshctl namespace list subcommand to solve this.

Here is exactly what I did:

  • Created the namespace subcommand which queries the Kubernetes API directly.
  • Filtered the results server-side using the istio.io/dataplane-mode=Kmesh label so it only returns namespaces that are actually enrolled in the mesh.
  • Formatted the output into a clean tabwriter table that displays the namespace name and explicitly shows if there is a waypoint attached by checking the istio.io/use-waypoint label.
  • Added unit tests for the command to ensure it's wired up correctly and to meet the >80% test coverage requirements for the MCP tools.

This PR lays the exact groundwork needed so that the MCP server can directly wrap this CLI command to discover namespaces!

User-Facing Changes
Users can now easily discover which namespaces are enrolled in Kmesh and see their waypoint status at a glance without having to run complex kubectl get ns -l ... queries.

Terminal Output:

When there are Kmesh-enrolled namespaces in the cluster:

$ kmeshctl namespace list
NAME            WAYPOINT
default         None
bookinfo        waypoint
kmesh-system    None

Copilot AI lite review requested due to automatic review settings August 14, 2026 10:08
@kmesh-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yaozengzeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from ec5cc8c to 75b40d4 Compare August 14, 2026 10:12
Copilot AI review requested due to automatic review settings August 14, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 8893a13 to d345b62 Compare August 14, 2026 10:14
Copilot AI review requested due to automatic review settings August 14, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.58%. Comparing base (c6357aa) to head (748c39e).
⚠️ Report is 14 commits behind head on main.
see 2 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec501a9...748c39e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LiZhenCheng9527

Copy link
Copy Markdown
Contributor

Is this PR still a draft?

Copilot AI review requested due to automatic review settings August 20, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@devGPP23

Copy link
Copy Markdown
Author

hi @LiZhenCheng9527
the implementation is actually complete & It is no longer a draft on my end

The reason it's still marked as a Draft is that I am currently blocked from clicking the 'Ready for Review' button because I've hit the open pull request limit for the repository (this is my 6th open PR).

I have 2 other open PRs that already have the lgtm label. Could you please merge those? Merging the approved ones will free up my limit and allow me to mark this PR as ready. Thanks

@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 7b06e5a to 9c64208 Compare August 20, 2026 21:27
Copilot AI review requested due to automatic review settings August 20, 2026 21:41
@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 9c64208 to d52e4fd Compare August 20, 2026 21:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 21, 2026 04:45
@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from d52e4fd to f969a47 Compare August 21, 2026 04:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from f969a47 to 18ee385 Compare August 21, 2026 08:55
Copilot AI review requested due to automatic review settings August 21, 2026 08:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 21, 2026 09:04
@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 18ee385 to 9d682a8 Compare August 21, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 21, 2026 09:24
@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 9d682a8 to 196509d Compare August 21, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 21, 2026 20:58
@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 196509d to 4029db0 Compare August 21, 2026 20:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 4029db0 to 3529624 Compare August 22, 2026 03:54
Copilot AI review requested due to automatic review settings August 22, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: devGPP23 <gauravpatil232005@gmail.com>
@devGPP23
devGPP23 force-pushed the feat/mcp-namespace-list branch from 3529624 to 748c39e Compare August 22, 2026 04:55
Copilot AI review requested due to automatic review settings August 22, 2026 04:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants