Files
cluster-map/README.md
T
Vitaliy ChefanovandClaude Opus 5.5 cf84e9976f UI rework: inventory tree, compact cards, live Hubble traffic
Frontend rewritten around three panes. Inventory tree on the left
(namespaces by kind, or nodes by namespace) with search and keyboard
navigation replaces the namespace checkbox list. The map shows only the
selected namespace(s) or node: fixed-size cards inside namespace boxes,
laid out in two elk passes so a big namespace packs into rows instead of
one tall column; zoom is capped so the view no longer jumps. Details
panel has Overview / Links / YAML / Logs tabs. Light and dark themes.
Libraries are vendored, no CDN.

Backend: /api/flows reads recent flows from hubble-relay (TLS verified
with the hubble CA, no client cert needed) and aggregates them per
source/destination/port. Pods are resolved to workloads with the same
rules as the graph, since Hubble leaves Workloads empty on some flows.
Pods under non-native controllers (kruise DaemonSet, CNPG clusters,
bare Jobs, static pods) are now graph nodes too. Probes move to
/healthz: /api/graph was timing out the 1s probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 19:50:53 +03:00

62 lines
2.6 KiB
Markdown

# cluster-map
Topology map of the Project Chimera Deckhouse cluster.
- **Left**: inventory tree in two views. *Namespaces* groups objects by
namespace and kind; *Ноды* shows what is scheduled on each node. Search
matches names, images and ingress hosts.
- **Centre**: the selected namespace(s) or node as compact cards inside
namespace boxes. Solid arrows come from configuration (Ingress → Service
→ workload by label selector); dashed animated arrows are real traffic
from Hubble Relay over the chosen window (5 min / 15 min / 1 h), red when
Cilium dropped some of it. Peers from other namespaces are drawn as
dashed "ghost" cards.
- **Right**: details for the selected object — overview, links (config and
traffic, clickable), live YAML, pod logs.
Workloads under non-native controllers (kruise Advanced DaemonSet behind
ingress-nginx, database operators, bare Jobs) are included and named the
way Hubble names them, so traffic attaches to the same cards.
## Backend
Go, `client-go` in-cluster config. Every `/api/graph` call lists the API
fresh — no cache, no watch. `/api/flows` reads recent flows from
`hubble-relay.d8-cni-cilium.svc:443` (TLS, verified with the public part of
Deckhouse's hubble CA mounted at `/etc/hubble-ca/ca.crt`; relay does not
ask for a client certificate) and aggregates them per source → destination
→ port. Replies are excluded, so each connection counts once.
| Endpoint | What |
|---|---|
| `/api/graph` | nodes + config edges + pod placement |
| `/api/flows?namespaces=a,b&window=300` | aggregated Hubble traffic |
| `/api/resource?kind=&namespace=&name=` | live YAML |
| `/api/pods?id=wl/<ns>/<kind>/<name>&namespace=` | pods of a workload |
| `/api/logs?namespace=&pod=&container=` | last 500 log lines |
| `/healthz` | liveness/readiness |
## Frontend
Plain JS, no build step: `static/index.html`, `app.css`, `app.js`.
Cytoscape.js draws, elkjs lays out in two passes (each box on its own with
its unconnected groups packed in rows, then the boxes against each other).
Both libraries are vendored in `static/vendor/` so the page works without a
CDN. Theme follows `prefers-color-scheme`.
## Build and deploy
The in-cluster registry can't be fed from inside the cluster yet (Kaniko's
image lives on gcr.io, blocked here), so for now:
```
docker build -t cluster-map:vX .
docker save cluster-map:vX -o cluster-map.tar
scp cluster-map.tar xeon:/tmp/
ssh xeon 'sudo /opt/deckhouse/bin/ctr -n k8s.io images import /tmp/cluster-map.tar'
```
The Deployment pins `nodeSelector: xeon` + `imagePullPolicy: Never`.
Manifests: `03-kubernetes/apps/cluster-map/` in `project-chimera`, mirrored
to `k8s-manifests` for Argo.