Skip to content

waypoint: compare dataplane-mode label case-insensitively like the daemon - #1983

Open
playlikeboy wants to merge 2 commits into
kmesh-net:mainfrom
playlikeboy:fix/waypoint-dataplane-mode-case
Open

playlikeboy wants to merge 2 commits into
kmesh-net:mainfrom
playlikeboy:fix/waypoint-dataplane-mode-case

Conversation

@playlikeboy

@playlikeboy playlikeboy commented Nov 5, 2026 •

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

kmeshctl waypoint apply --enroll-namespace checked the istio.io/dataplane-mode namespace label against the exact string "Kmesh", while the daemon (pkg/utils.ShouldEnroll) compares the value with strings.EqualFold against constants.DataPlaneModeKmesh ("kmesh"). A namespace labelled istio.io/dataplane-mode=kmesh is therefore enrolled by the daemon, but kmeshctl still warns that it is not.

This PR replaces the exact comparison in ctl/waypoint/waypoint.go with a case-insensitive one that reuses the constants from pkg/constants (namespaceIsEnrolledInKmesh) and adds ctl/waypoint/waypoint_enroll_test.go, which asserts for each label value that kmeshctl and utils.ShouldEnroll reach the same decision.

The warning text itself (kubectl label namespace <ns> istio.io/dataplane-mode=Kmesh) is unchanged; both spellings now work on both sides.

Which issue(s) this PR fixes:
Fixes #1982

Special notes for your reviewer:

  • mcp/tools.go uses the same exact-match label selector in get_mesh_namespaces; I left it out of this PR because the MCP server is in active development in feat(mcp): implement Phase 3 (smart filtering, memory guards, stdio transport, and 80%+ test suite) #1969. Happy to follow up there if wanted.
  • Verified locally with go build ./ctl/..., go vet ./ctl/waypoint/, gofmt -l, and go test ./ctl/waypoint/ -run TestNamespaceIsEnrolledInKmesh (the test file did not compile before the fix because the helper did not exist; after the fix the 6 subtests of TestNamespaceIsEnrolledInKmesh and the missing-namespace test pass). I could not run make gen-check or the eBPF test paths on my machine (kernel 4.18, no clang), so CI will be the first run of those.
  • AI disclosure: parts of this change were drafted with an AI assistant (Claude Code). I reviewed every line and ran the checks above myself.

Does this PR introduce a user-facing change?:

kmeshctl waypoint apply --enroll-namespace no longer warns that a namespace is not enrolled when its istio.io/dataplane-mode label uses a different letter case than "Kmesh" (for example "kmesh"), matching the daemon's enrollment check.

🤖 Generated with Claude Code

…emon

kmeshctl waypoint apply --enroll-namespace checked the
istio.io/dataplane-mode namespace label against the exact string "Kmesh",
while the daemon (pkg/utils.ShouldEnroll) compares it with
strings.EqualFold. A namespace labelled dataplane-mode=kmesh is therefore
enrolled by the daemon but kmeshctl still warns that it is not.

Replace the exact comparison with a case-insensitive one that reuses the
constants from pkg/constants, and add a unit test that checks kmeshctl and
the daemon agree for the same namespace labels.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Shaswat Raj <shaswat340@gmail.com>
@kmesh-bot kmesh-bot added the kind/bug Something isn't working label Nov 5, 2026
@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 kevin-wangzefeng 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

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.87%. Comparing base (c48f7f0) to head (f07cafa).
⚠️ Report is 3 commits behind head on main.


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 b25c1a2...f07cafa. Read the comment docs.

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

Removing it was not needed for the fix; keep the change to the comparison
itself so the diff stays minimal.

Signed-off-by: Shaswat Raj <shaswat340@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kmeshctl waypoint: dataplane-mode label compared case-sensitively, disagrees with the daemon's enrollment check

2 participants