Repository navigation
feat(api): topology names the sections Kubernetes refused to read - #509
Merged
Merged
Conversation
An admin-less Kates (rbac.scope=namespace) may read only part of the Kafka namespace, and nodes not at all. ClusterTopologyService swallowed every failed read, so a refused section looked like an empty cluster: no topics, no services, no nodes. - GET /api/cluster/topology adds `unread`: each section Kubernetes refused a read for (HTTP 403), with the API server's message, which names the verb, resource and namespace. A refused Kafka resource names every section built from it. - A refused pod list in the Kafka namespace now says so, and how to grant it, instead of "requires the backend to be running on Kubernetes". - kates cluster topology warns with the unread sections, grouped by message, and shows the backend's message on a 503. - The cluster_topology MCP tool reports topology.unread for the sections it reads (kafka, nodePools, nodes), the API server's message fenced. - Troubleshooting appendix: both new messages.
# Conflicts: # docs/book/appendix-b-troubleshooting.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On an admin-less install (
rbac.scope=namespace), the Kates API may read only part of the Kafka namespace: the chart's Role grants what a conformity check reads, and nodes are cluster-scoped.ClusterTopologyServiceswallowed every failed read, so a refused section looked like an empty cluster, for example "0 topics", no services and no node list. When the Role was missing entirely, the refused pod list came back as "requires the backend to be running on Kubernetes", which was wrong: the backend was on Kubernetes but lacked permission.This is PR 1 of the admin-less topology study: report what was refused before adding fallbacks or new grants.
What
GET /api/cluster/topologyaddsunread: each section Kubernetes refused a read for (HTTP 403), with the API server's message, which names the verb, resource and namespace. It is always present, and empty when everything was read. A refused Kafka resource names every section built from it (cluster,kafkaConfig,entityOperator,cruiseControl,kafkaExporter,certificates,metrics). Sections keep their current, possibly empty, values, so existing consumers (REST, gRPC) see no change.<ns>: bind it a Role there that grants it, such as the kates chart's with rbac.scope=namespace. The API server said: …", the same wording conformity uses. Other failures keep the old "not on Kubernetes" message.kates cluster topologywarns under the banner with the unread sections, grouped by message. On an error it prints the backend's message instead of the fixed "only available when deployed on Kubernetes" text.cluster_topologyreportstopology.unread(section+ fencedreason) for the sections it reads:kafka,nodePoolsandnodes. Its 503 explanation and thetopology-unread-looks-emptycaveat mention the refused case. The golden file is regenerated.ClusterTopologyService.javaandClusterResource.javaare re-pointed after the shift.Deliberately not done
pod.spec.nodeName, zones from EndpointSlices, the Strimzi version fromstatus.operatorLastSuccessfulVersion, and Endpoints → EndpointSlices.rbac.topologyReads(PR 3).GetClusterTopology:unreadwould need akates.protochange, and it can't be regenerated on this Mac.Tests
New:
ClusterTopologyServiceTest, which uses the fabric8 mock server with real API-server 403Statusbodies:unread;CLI:
TestClusterTopologyCmdNamesTheUnreadSections,TestClusterTopologyCmdPassesTheBackendsRefusalOnandTestMCPClusterTopologyNamesRefusedReads.Run locally, all green:
./mvnw test -Dquarkus.grpc.codegen.skip=true -Dquarkus.http.test-port=0: 1,738 tests, 0 failures.spotless:checkpasses.cli:go test ./...,go vet ./...,golangci-lint run --new-from-rev=origin/main ./...(0 issues),govulncheck ./...;scripts/check-cli-style.sh,scripts/check-cli-compat.sh.check-book-style.sh,gen-version-matrix.sh --check,gen-chart-table.sh --check,check-book-contrast.py,check-mermaid.sh. In a scratch-copy render, HTML pluscheck-book-fragments.py(8,137 links OK) and the PDF both pass. The PDF's missing glyphs are only the usual six local emoji.Left to CI:
*ITtests, the native image, Kind integration and the Docker builds (Docker is off here). I haven't run this against a live admin-less install.