Data Flow
AI Operations Path
Page context + user prompt
│
▼
AI Chat Handler ──→ OpenAI-compatible provider
▲ │
│ tool request
│ ▼
streamed result ← Authorizer → Kubernetes/Logs/Prometheus
│
mutation requested?
│
pause for user approval
│
re-authorize → execute → audit
- The browser sends the selected cluster, namespace, page, resource, and chat history.
- The provider can request only the tools registered by KubeVision.
- The server maps each tool and arguments to the current user's RBAC permission.
- Read tools execute immediately after authorization and return bounded output.
- A mutation creates a short-lived, user-owned pending action instead of executing.
- Confirmation consumes that pending action, re-checks permission, executes once, and records the outcome in the audit log.
The agent loop and tool output are bounded. Arbitrary shell execution and arbitrary outbound HTTP access are not model tools.
Read Path
Browser → Handler → Service → K8sRepo
│
┌────────────┴────────────┐
│ │
Informer Cache API Server
(sub-ms, 8 types) (fallback, all types)
- Handler receives GET request
- Service delegates to K8sRepo
- K8sRepo checks Informer cache first (8 core resources)
- If cache miss or resource not cached, falls back to API Server
- Response includes
meta.source("cache" or "apiserver") andmeta.staleflag
Write Path
Browser → Handler → Service → K8sRepo → API Server
│
Informer Watch
│
EventListener
│
WS Hub
│
All Browsers
- Handler receives POST/PUT/DELETE request
- Service validates and delegates to K8sRepo
- K8sRepo calls API Server directly
- API Server applies the change
- Informer Watch detects the change
- EventListener notifies WS Hub
- Hub broadcasts to all connected browsers
- Browsers update automatically (no polling needed)
Real-time Push
The real-time system is fully decoupled:
// EventListener interface — Hub implements this
type EventListener interface {
OnResourceEvent(event ResourceEvent)
}
// Hub: non-blocking receive, drop if channel full
// (frontend has 30s fallback polling)
func (h *Hub) OnResourceEvent(event ResourceEvent) {
select {
case h.broadcast <- marshal(event):
default: // drop, don't block Informer
}
}
Informer Cache Strategy
| Cached (8 types) | On-Demand | Never Cached |
|---|---|---|
| Pods | Jobs | Secrets (security) |
| Deployments | CronJobs | Events (volume) |
| StatefulSets | ConfigMaps | |
| DaemonSets | PVs, PVCs | |
| Services | StorageClasses | |
| Ingresses | NetworkPolicies | |
| Nodes | Roles, RoleBindings | |
| Namespaces | ServiceAccounts |