Repository navigation
waypoint: compare dataplane-mode label case-insensitively like the daemon - #1983
playlikeboy wants to merge 2 commits into
Conversation
…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>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
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>
What type of PR is this?
/kind bug
What this PR does / why we need it:
kmeshctl waypoint apply --enroll-namespacechecked theistio.io/dataplane-modenamespace label against the exact string"Kmesh", while the daemon (pkg/utils.ShouldEnroll) compares the value withstrings.EqualFoldagainstconstants.DataPlaneModeKmesh("kmesh"). A namespace labelledistio.io/dataplane-mode=kmeshis therefore enrolled by the daemon, butkmeshctlstill warns that it is not.This PR replaces the exact comparison in
ctl/waypoint/waypoint.gowith a case-insensitive one that reuses the constants frompkg/constants(namespaceIsEnrolledInKmesh) and addsctl/waypoint/waypoint_enroll_test.go, which asserts for each label value thatkmeshctlandutils.ShouldEnrollreach 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.gouses the same exact-match label selector inget_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.go build ./ctl/...,go vet ./ctl/waypoint/,gofmt -l, andgo 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 ofTestNamespaceIsEnrolledInKmeshand the missing-namespace test pass). I could not runmake gen-checkor the eBPF test paths on my machine (kernel 4.18, no clang), so CI will be the first run of those.Does this PR introduce a user-facing change?:
🤖 Generated with Claude Code