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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2ac0ddb6ba
commit
cf84e9976f
+4
-4
@@ -1,9 +1,9 @@
|
||||
FROM golang:1.22-alpine AS build
|
||||
FROM golang:1.25-alpine AS build
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum* ./
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY main.go ./
|
||||
RUN CGO_ENABLED=0 go build -o /cluster-map .
|
||||
COPY *.go ./
|
||||
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /cluster-map .
|
||||
|
||||
FROM alpine:3.20
|
||||
RUN adduser -D -u 10001 app
|
||||
|
||||
@@ -1,20 +1,61 @@
|
||||
# cluster-map
|
||||
|
||||
Interactive topology view of the Project Chimera Deckhouse cluster --
|
||||
namespaces group workloads (Deployment/StatefulSet/DaemonSet/CronJob),
|
||||
connected to Services (by label-selector match) and Ingresses (by backend
|
||||
reference), plus a physical-node layer showing what's actually scheduled
|
||||
where. Click any node for its live manifest.
|
||||
Topology map of the Project Chimera Deckhouse cluster.
|
||||
|
||||
Go backend (client-go, builds the graph fresh from the k8s API on every
|
||||
`/api/graph` request -- no caching, no watch loop, correct by construction)
|
||||
+ a single-page Cytoscape.js frontend, no build step.
|
||||
- **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.
|
||||
|
||||
Phase 1 (current): plain in-cluster app, deployed like everything else in
|
||||
this project (`03-kubernetes/apps/cluster-map/` in the `project-chimera`
|
||||
docs repo, mirrored to `k8s-manifests` for Argo). No Hubble traffic overlay
|
||||
yet, no packaging as an actual Deckhouse module (ModuleConfig/ModuleSource)
|
||||
-- both are deliberately deferred until the base idea proves useful.
|
||||
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.
|
||||
|
||||
See STATUS.md / OpenProject (chimera-core) in `project-chimera` for the
|
||||
full design rationale and decision history.
|
||||
## 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.
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
flowpb "github.com/cilium/cilium/api/v1/flow"
|
||||
observerpb "github.com/cilium/cilium/api/v1/observer"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Relay serves a *.hubble-relay.cilium.io certificate signed by Deckhouse's
|
||||
// hubble CA and does not ask for a client certificate, so plain TLS with
|
||||
// that CA is enough. The CA is mounted from a ConfigMap (public part only).
|
||||
const hubbleServerName = "cluster-map.hubble-relay.cilium.io"
|
||||
|
||||
var observer observerpb.ObserverClient
|
||||
var hubbleInitErr error
|
||||
|
||||
func initHubble() {
|
||||
addr := envOr("HUBBLE_RELAY_ADDR", "hubble-relay.d8-cni-cilium.svc:443")
|
||||
caPEM, err := os.ReadFile(envOr("HUBBLE_CA_FILE", "/etc/hubble-ca/ca.crt"))
|
||||
if err != nil {
|
||||
hubbleInitErr = fmt.Errorf("hubble CA: %w", err)
|
||||
return
|
||||
}
|
||||
pool := x509.NewCertPool()
|
||||
if !pool.AppendCertsFromPEM(caPEM) {
|
||||
hubbleInitErr = errors.New("hubble CA: no certificate in file")
|
||||
return
|
||||
}
|
||||
creds := credentials.NewTLS(&tls.Config{RootCAs: pool, ServerName: hubbleServerName, MinVersion: tls.VersionTLS12})
|
||||
conn, err := grpc.NewClient(addr, grpc.WithTransportCredentials(creds))
|
||||
if err != nil {
|
||||
hubbleInitErr = err
|
||||
return
|
||||
}
|
||||
observer = observerpb.NewObserverClient(conn)
|
||||
}
|
||||
|
||||
func envOr(k, def string) string {
|
||||
if v := os.Getenv(k); v != "" {
|
||||
return v
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
type FlowEndpoint struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Kind string `json:"kind"` // lowercased controller kind, "pod", or "external"
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
type FlowEdge struct {
|
||||
Source string `json:"source"`
|
||||
Target string `json:"target"`
|
||||
Port string `json:"port"` // "443/TCP"
|
||||
Count int `json:"count"`
|
||||
Dropped int `json:"dropped"`
|
||||
Last string `json:"last"`
|
||||
}
|
||||
|
||||
type FlowsResult struct {
|
||||
WindowSec int `json:"windowSec"`
|
||||
Scanned int `json:"scanned"`
|
||||
Endpoints []FlowEndpoint `json:"endpoints"`
|
||||
Edges []FlowEdge `json:"edges"`
|
||||
}
|
||||
|
||||
const maxFlows = 20000
|
||||
|
||||
// handleFlows aggregates recent Hubble flows touching the given namespaces
|
||||
// into workload-to-workload edges. Replies are excluded so each connection
|
||||
// is counted once, in the direction it was opened.
|
||||
func handleFlows(w http.ResponseWriter, r *http.Request) {
|
||||
if observer == nil {
|
||||
http.Error(w, "hubble недоступен: "+errString(hubbleInitErr), http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
var namespaces []string
|
||||
for _, ns := range strings.Split(r.URL.Query().Get("namespaces"), ",") {
|
||||
if ns = strings.TrimSpace(ns); ns != "" {
|
||||
namespaces = append(namespaces, ns)
|
||||
}
|
||||
}
|
||||
if len(namespaces) == 0 || len(namespaces) > 50 {
|
||||
http.Error(w, "namespaces: от 1 до 50 через запятую", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
window, _ := strconv.Atoi(r.URL.Query().Get("window"))
|
||||
if window <= 0 {
|
||||
window = 300
|
||||
}
|
||||
if window > 3600 {
|
||||
window = 3600
|
||||
}
|
||||
|
||||
var podPrefixes []string
|
||||
for _, ns := range namespaces {
|
||||
podPrefixes = append(podPrefixes, ns+"/")
|
||||
}
|
||||
notReply := []bool{false}
|
||||
req := &observerpb.GetFlowsRequest{
|
||||
Number: maxFlows,
|
||||
Since: timestamppb.New(time.Now().Add(-time.Duration(window) * time.Second)),
|
||||
Whitelist: []*flowpb.FlowFilter{
|
||||
{SourcePod: podPrefixes, Reply: notReply},
|
||||
{DestinationPod: podPrefixes, Reply: notReply},
|
||||
},
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(r.Context(), 15*time.Second)
|
||||
defer cancel()
|
||||
stream, err := observer.GetFlows(ctx, req)
|
||||
if err != nil {
|
||||
http.Error(w, "hubble: "+err.Error(), http.StatusBadGateway)
|
||||
return
|
||||
}
|
||||
|
||||
// Hubble leaves Endpoint.Workloads empty for some flows (typically the
|
||||
// half observed on the peer's node), so pods are resolved to their
|
||||
// workload here, with the same podOwner rules the graph uses.
|
||||
pods, err := clientset.CoreV1().Pods(corev1.NamespaceAll).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
podWl := make(map[string]FlowEndpoint, len(pods.Items))
|
||||
for _, p := range pods.Items {
|
||||
if kind, name, _ := podOwner(p); kind != "" {
|
||||
podWl[p.Namespace+"/"+p.Name] = FlowEndpoint{ID: workloadID(p.Namespace, kind, name), Label: name, Kind: kind, Namespace: p.Namespace}
|
||||
}
|
||||
}
|
||||
|
||||
res := FlowsResult{WindowSec: window}
|
||||
endpoints := map[string]FlowEndpoint{}
|
||||
edges := map[string]*FlowEdge{}
|
||||
for {
|
||||
resp, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
if res.Scanned == 0 {
|
||||
http.Error(w, "hubble: "+err.Error(), http.StatusBadGateway)
|
||||
return
|
||||
}
|
||||
break // partial result is still useful
|
||||
}
|
||||
f := resp.GetFlow()
|
||||
if f == nil {
|
||||
continue
|
||||
}
|
||||
res.Scanned++
|
||||
src := flowEndpoint(f.GetSource(), f.GetSourceNames(), f.GetNodeName(), podWl)
|
||||
dst := flowEndpoint(f.GetDestination(), f.GetDestinationNames(), f.GetNodeName(), podWl)
|
||||
if src.ID == dst.ID {
|
||||
continue
|
||||
}
|
||||
endpoints[src.ID] = src
|
||||
endpoints[dst.ID] = dst
|
||||
port := l4Port(f.GetL4())
|
||||
key := src.ID + "|" + dst.ID + "|" + port
|
||||
e := edges[key]
|
||||
if e == nil {
|
||||
e = &FlowEdge{Source: src.ID, Target: dst.ID, Port: port}
|
||||
edges[key] = e
|
||||
}
|
||||
e.Count++
|
||||
if f.GetVerdict() == flowpb.Verdict_DROPPED {
|
||||
e.Dropped++
|
||||
}
|
||||
if t := f.GetTime(); t != nil {
|
||||
if ts := t.AsTime().UTC().Format(time.RFC3339); ts > e.Last {
|
||||
e.Last = ts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, ep := range endpoints {
|
||||
res.Endpoints = append(res.Endpoints, ep)
|
||||
}
|
||||
for _, e := range edges {
|
||||
res.Edges = append(res.Edges, *e)
|
||||
}
|
||||
sort.Slice(res.Endpoints, func(i, j int) bool { return res.Endpoints[i].ID < res.Endpoints[j].ID })
|
||||
sort.Slice(res.Edges, func(i, j int) bool { return res.Edges[i].Count > res.Edges[j].Count })
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(res)
|
||||
}
|
||||
|
||||
// flowEndpoint maps a Hubble endpoint to an ID that matches a graph node
|
||||
// when the peer is one of our workloads, so traffic edges attach to the
|
||||
// same cards the structural graph already draws.
|
||||
func flowEndpoint(e *flowpb.Endpoint, names []string, nodeName string, podWl map[string]FlowEndpoint) FlowEndpoint {
|
||||
if e.GetPodName() != "" {
|
||||
ns := e.GetNamespace()
|
||||
if ep, ok := podWl[ns+"/"+e.GetPodName()]; ok {
|
||||
return ep
|
||||
}
|
||||
// pod already gone: fall back to what Hubble recorded
|
||||
for _, wl := range e.GetWorkloads() {
|
||||
kind, name := strings.ToLower(wl.GetKind()), wl.GetName()
|
||||
if kind == "job" {
|
||||
if i := strings.LastIndex(name, "-"); i > 0 && allDigits(name[i+1:]) {
|
||||
kind, name = "cronjob", name[:i]
|
||||
}
|
||||
}
|
||||
if kind == "" || name == "" {
|
||||
continue
|
||||
}
|
||||
return FlowEndpoint{ID: workloadID(ns, kind, name), Label: name, Kind: kind, Namespace: ns}
|
||||
}
|
||||
return FlowEndpoint{ID: "pod/" + ns + "/" + e.GetPodName(), Label: e.GetPodName(), Kind: "pod", Namespace: ns}
|
||||
}
|
||||
labels := e.GetLabels()
|
||||
has := func(l string) bool {
|
||||
for _, x := range labels {
|
||||
if x == l {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
switch {
|
||||
case has("reserved:host"):
|
||||
return FlowEndpoint{ID: "ext/host/" + nodeName, Label: "host " + nodeName, Kind: "external"}
|
||||
case has("reserved:remote-node"):
|
||||
return FlowEndpoint{ID: "ext/remote-node", Label: "другие ноды", Kind: "external"}
|
||||
case has("reserved:kube-apiserver"):
|
||||
return FlowEndpoint{ID: "ext/kube-apiserver", Label: "kube-apiserver", Kind: "external"}
|
||||
case has("reserved:health"):
|
||||
return FlowEndpoint{ID: "ext/health", Label: "cilium health", Kind: "external"}
|
||||
}
|
||||
if len(names) > 0 {
|
||||
return FlowEndpoint{ID: "ext/dns/" + names[0], Label: names[0], Kind: "external"}
|
||||
}
|
||||
return FlowEndpoint{ID: "ext/world", Label: "интернет", Kind: "external"}
|
||||
}
|
||||
|
||||
func l4Port(l4 *flowpb.Layer4) string {
|
||||
switch {
|
||||
case l4.GetTCP() != nil:
|
||||
return strconv.Itoa(int(l4.GetTCP().GetDestinationPort())) + "/TCP"
|
||||
case l4.GetUDP() != nil:
|
||||
return strconv.Itoa(int(l4.GetUDP().GetDestinationPort())) + "/UDP"
|
||||
case l4.GetICMPv4() != nil || l4.GetICMPv6() != nil:
|
||||
return "ICMP"
|
||||
case l4.GetSCTP() != nil:
|
||||
return strconv.Itoa(int(l4.GetSCTP().GetDestinationPort())) + "/SCTP"
|
||||
}
|
||||
return "?"
|
||||
}
|
||||
|
||||
func errString(err error) string {
|
||||
if err == nil {
|
||||
return "не инициализирован"
|
||||
}
|
||||
return err.Error()
|
||||
}
|
||||
@@ -1,46 +1,52 @@
|
||||
module git.project-chimera.ru/fanchji/cluster-map
|
||||
|
||||
go 1.22.0
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
k8s.io/api v0.30.3
|
||||
k8s.io/apimachinery v0.30.3
|
||||
k8s.io/client-go v0.30.3
|
||||
github.com/cilium/cilium v1.17.4
|
||||
google.golang.org/grpc v1.84.0
|
||||
google.golang.org/protobuf v1.36.11
|
||||
k8s.io/api v0.32.0
|
||||
k8s.io/apimachinery v0.32.0
|
||||
k8s.io/client-go v0.32.0
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
||||
github.com/go-logr/logr v1.4.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
golang.org/x/net v0.23.0 // indirect
|
||||
golang.org/x/oauth2 v0.10.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/term v0.18.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
golang.org/x/net v0.57.0 // indirect
|
||||
golang.org/x/oauth2 v0.36.0 // indirect
|
||||
golang.org/x/sys v0.47.0 // indirect
|
||||
golang.org/x/term v0.45.0 // indirect
|
||||
golang.org/x/text v0.40.0 // indirect
|
||||
golang.org/x/time v0.8.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260706201446-f0a921348800 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/klog/v2 v2.120.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
|
||||
)
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/cilium/cilium v1.17.4 h1:fO1VBbBLU69wbhN2csULVLPs7gR3qr0IrnYmI2SwU40=
|
||||
github.com/cilium/cilium v1.17.4/go.mod h1:wVAXueJW11HUvZo0c+szVo7zeCLZ5yOCgNHP0lwiS8g=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
|
||||
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
|
||||
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
|
||||
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapwQtU84iWk=
|
||||
github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
|
||||
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
|
||||
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
|
||||
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
|
||||
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
|
||||
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
|
||||
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
|
||||
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
@@ -53,25 +53,26 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY=
|
||||
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
|
||||
github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE=
|
||||
github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
|
||||
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
|
||||
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
|
||||
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace h1:9PNP1jnUjRhfmGMlkXHjYPishpcw4jpSt/V/xYY3FMA=
|
||||
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
@@ -80,71 +81,71 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8=
|
||||
golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI=
|
||||
golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
|
||||
golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
|
||||
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
|
||||
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
|
||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
||||
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=
|
||||
golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
|
||||
golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
|
||||
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
|
||||
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
|
||||
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
|
||||
golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q=
|
||||
golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260706201446-f0a921348800 h1:qEHAMpSaUhtD0p3NbEEI83HwNGFxEwaSJ1G9PLnCBZE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260706201446-f0a921348800/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0=
|
||||
google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0=
|
||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4=
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ=
|
||||
k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04=
|
||||
k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc=
|
||||
k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
|
||||
k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k=
|
||||
k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U=
|
||||
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
|
||||
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
|
||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
|
||||
k8s.io/api v0.32.0 h1:OL9JpbvAU5ny9ga2fb24X8H6xQlVp+aJMFlgtQjR9CE=
|
||||
k8s.io/api v0.32.0/go.mod h1:4LEwHZEf6Q/cG96F3dqR965sYOfmPM7rq81BLgsE0p0=
|
||||
k8s.io/apimachinery v0.32.0 h1:cFSE7N3rmEEtv4ei5X6DaJPHHX0C+upp+v5lVPiEwpg=
|
||||
k8s.io/apimachinery v0.32.0/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
|
||||
k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8=
|
||||
k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y=
|
||||
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4=
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0=
|
||||
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
|
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -63,7 +63,14 @@ func main() {
|
||||
log.Fatalf("building clientset: %v", err)
|
||||
}
|
||||
|
||||
initHubble()
|
||||
if hubbleInitErr != nil {
|
||||
log.Printf("hubble disabled: %v", hubbleInitErr)
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) { w.Write([]byte("ok")) })
|
||||
mux.HandleFunc("/api/flows", handleFlows)
|
||||
mux.HandleFunc("/api/graph", handleGraph)
|
||||
mux.HandleFunc("/api/resource", handleResource)
|
||||
mux.HandleFunc("/api/pods", handlePods)
|
||||
@@ -166,6 +173,64 @@ func buildGraph(ctx context.Context) (*Graph, error) {
|
||||
// CronJob pods don't back a Service, so no labels needed for matching.
|
||||
}
|
||||
|
||||
// Pods whose controller is not a native workload (kruise Advanced
|
||||
// DaemonSet behind ingress-nginx, database operators, bare Jobs) would
|
||||
// otherwise be invisible. They become workload nodes of their own, IDed
|
||||
// the way Hubble names workloads, so traffic attaches to them too.
|
||||
pods, err := clientset.CoreV1().Pods(corev1.NamespaceAll).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
known := map[string]bool{}
|
||||
for _, n := range g.Nodes {
|
||||
known[n.ID] = true
|
||||
}
|
||||
type foreignWl struct {
|
||||
ns, kind, name, controller string
|
||||
pods, ready int
|
||||
labels map[string]string
|
||||
}
|
||||
foreign := map[string]*foreignWl{}
|
||||
for _, p := range pods.Items {
|
||||
kind, name, ctrl := podOwner(p)
|
||||
if kind == "" {
|
||||
continue
|
||||
}
|
||||
id := workloadID(p.Namespace, kind, name)
|
||||
if known[id] {
|
||||
continue
|
||||
}
|
||||
f := foreign[id]
|
||||
if f == nil {
|
||||
f = &foreignWl{ns: p.Namespace, kind: kind, name: name, controller: ctrl, labels: p.Labels}
|
||||
foreign[id] = f
|
||||
}
|
||||
if p.Status.Phase == corev1.PodSucceeded {
|
||||
continue
|
||||
}
|
||||
f.pods++
|
||||
if podReady(p) {
|
||||
f.ready++
|
||||
}
|
||||
}
|
||||
for id, f := range foreign {
|
||||
kind := f.kind
|
||||
switch kind {
|
||||
case "deployment", "statefulset", "daemonset", "cronjob":
|
||||
default:
|
||||
kind = "pod"
|
||||
}
|
||||
n := workloadNode(id, kind, f.ns, f.name, map[string]string{
|
||||
"controller": f.controller,
|
||||
"pods": itoa(f.pods),
|
||||
"ready": itoa(f.ready),
|
||||
"health": health(f.pods, f.ready),
|
||||
"foreign": "true",
|
||||
})
|
||||
g.Nodes = append(g.Nodes, n)
|
||||
workloads = append(workloads, workloadRef{id, f.labels})
|
||||
}
|
||||
|
||||
services, err := clientset.CoreV1().Services(corev1.NamespaceAll).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -214,10 +279,6 @@ func buildGraph(ctx context.Context) (*Graph, error) {
|
||||
g.Nodes = append(g.Nodes, Node{ID: "node/" + n.Name, Label: n.Name, Kind: "node", Facts: nodeFacts(n)})
|
||||
}
|
||||
|
||||
pods, err := clientset.CoreV1().Pods(corev1.NamespaceAll).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
seenPlacement := map[string]bool{}
|
||||
for _, p := range pods.Items {
|
||||
if p.Spec.NodeName == "" {
|
||||
@@ -240,32 +301,70 @@ func buildGraph(ctx context.Context) (*Graph, error) {
|
||||
return g, nil
|
||||
}
|
||||
|
||||
// ownerWorkloadID walks a Pod's ownerReferences to find the workload node ID
|
||||
// this pod belongs to. ReplicaSet-owned pods (Deployments) are attributed to
|
||||
// the Deployment, not the intermediate ReplicaSet, since we don't graph
|
||||
// ReplicaSets as their own nodes.
|
||||
func ownerWorkloadID(p corev1.Pod) string {
|
||||
for _, o := range p.OwnerReferences {
|
||||
// podOwner names the workload a pod belongs to the way Hubble does
|
||||
// (cilium's GetWorkloadMetaFromPod): ReplicaSet -> its Deployment, a Job
|
||||
// whose name ends in the scheduler's numeric suffix -> its CronJob, any
|
||||
// other controller kind as-is. controller is "<apiVersion> <Kind>".
|
||||
func podOwner(p corev1.Pod) (kind, name, controller string) {
|
||||
var o *metav1.OwnerReference
|
||||
for i := range p.OwnerReferences {
|
||||
if p.OwnerReferences[i].Controller != nil && *p.OwnerReferences[i].Controller {
|
||||
o = &p.OwnerReferences[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
if o == nil && len(p.OwnerReferences) > 0 {
|
||||
o = &p.OwnerReferences[0]
|
||||
}
|
||||
if o == nil {
|
||||
return "", "", ""
|
||||
}
|
||||
controller = o.APIVersion + " " + o.Kind
|
||||
switch o.Kind {
|
||||
case "StatefulSet":
|
||||
return workloadID(p.Namespace, "statefulset", o.Name)
|
||||
case "DaemonSet":
|
||||
return workloadID(p.Namespace, "daemonset", o.Name)
|
||||
case "Node":
|
||||
// static pod mirrored by the kubelet: "<component>-<node>", grouped
|
||||
// per component across nodes like a DaemonSet would be
|
||||
return "staticpod", strings.TrimSuffix(p.Name, "-"+p.Spec.NodeName), "static pod (kubelet)"
|
||||
case "ReplicaSet":
|
||||
// name is "<deployment>-<hash>" by convention; the owning
|
||||
// Deployment isn't in the Pod's own ownerReferences, so this is
|
||||
// the standard heuristic (kubectl itself does the same thing).
|
||||
if i := strings.LastIndex(o.Name, "-"); i > 0 {
|
||||
return workloadID(p.Namespace, "deployment", o.Name[:i])
|
||||
return "deployment", o.Name[:i], controller
|
||||
}
|
||||
case "Job":
|
||||
if i := strings.LastIndex(o.Name, "-"); i > 0 {
|
||||
return workloadID(p.Namespace, "cronjob", o.Name[:i])
|
||||
if i := strings.LastIndex(o.Name, "-"); i > 0 && allDigits(o.Name[i+1:]) {
|
||||
return "cronjob", o.Name[:i], controller
|
||||
}
|
||||
}
|
||||
return strings.ToLower(o.Kind), o.Name, controller
|
||||
}
|
||||
|
||||
func allDigits(s string) bool {
|
||||
if s == "" {
|
||||
return false
|
||||
}
|
||||
for _, c := range s {
|
||||
if c < '0' || c > '9' {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func podReady(p corev1.Pod) bool {
|
||||
for _, c := range p.Status.Conditions {
|
||||
if c.Type == corev1.PodReady {
|
||||
return c.Status == corev1.ConditionTrue
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ownerWorkloadID(p corev1.Pod) string {
|
||||
kind, name, _ := podOwner(p)
|
||||
if kind == "" {
|
||||
return ""
|
||||
}
|
||||
return workloadID(p.Namespace, kind, name)
|
||||
}
|
||||
|
||||
func workloadID(ns, kind, name string) string { return "wl/" + ns + "/" + kind + "/" + name }
|
||||
|
||||
@@ -312,11 +411,33 @@ func firstContainerImage(containers []corev1.Container) string {
|
||||
return containers[0].Image
|
||||
}
|
||||
|
||||
// health is what the status dot on a card shows: ok, warn (partly ready),
|
||||
// error (nothing ready), idle (scaled to zero or suspended).
|
||||
func health(want, ready int) string {
|
||||
switch {
|
||||
case want == 0:
|
||||
return "idle"
|
||||
case ready >= want:
|
||||
return "ok"
|
||||
case ready == 0:
|
||||
return "error"
|
||||
}
|
||||
return "warn"
|
||||
}
|
||||
|
||||
func replicasOf(p *int32) int {
|
||||
if p == nil {
|
||||
return 1
|
||||
}
|
||||
return int(*p)
|
||||
}
|
||||
|
||||
func deploymentFacts(d appsv1.Deployment) map[string]string {
|
||||
return map[string]string{
|
||||
"replicas": itoa32(d.Spec.Replicas),
|
||||
"readyReplicas": itoa(int(d.Status.ReadyReplicas)),
|
||||
"image": firstContainerImage(d.Spec.Template.Spec.Containers),
|
||||
"health": health(replicasOf(d.Spec.Replicas), int(d.Status.ReadyReplicas)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,6 +446,7 @@ func statefulsetFacts(s appsv1.StatefulSet) map[string]string {
|
||||
"replicas": itoa32(s.Spec.Replicas),
|
||||
"readyReplicas": itoa(int(s.Status.ReadyReplicas)),
|
||||
"image": firstContainerImage(s.Spec.Template.Spec.Containers),
|
||||
"health": health(replicasOf(s.Spec.Replicas), int(s.Status.ReadyReplicas)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,13 +455,18 @@ func daemonsetFacts(ds appsv1.DaemonSet) map[string]string {
|
||||
"desired": itoa(int(ds.Status.DesiredNumberScheduled)),
|
||||
"ready": itoa(int(ds.Status.NumberReady)),
|
||||
"image": firstContainerImage(ds.Spec.Template.Spec.Containers),
|
||||
"health": health(int(ds.Status.DesiredNumberScheduled), int(ds.Status.NumberReady)),
|
||||
}
|
||||
}
|
||||
|
||||
func cronjobFacts(cj batchv1.CronJob) map[string]string {
|
||||
f := map[string]string{"schedule": cj.Spec.Schedule}
|
||||
f := map[string]string{"schedule": cj.Spec.Schedule, "health": "ok", "active": itoa(len(cj.Status.Active))}
|
||||
if cj.Spec.Suspend != nil && *cj.Spec.Suspend {
|
||||
f["suspended"] = "true"
|
||||
f["health"] = "idle"
|
||||
}
|
||||
if cj.Status.LastSuccessfulTime != nil {
|
||||
f["lastSuccess"] = cj.Status.LastSuccessfulTime.UTC().Format("2006-01-02 15:04")
|
||||
}
|
||||
return f
|
||||
}
|
||||
@@ -373,7 +500,11 @@ func nodeFacts(n corev1.Node) map[string]string {
|
||||
ready = string(c.Status)
|
||||
}
|
||||
}
|
||||
return map[string]string{"ready": ready, "os": n.Status.NodeInfo.OSImage}
|
||||
h := "ok"
|
||||
if ready != "True" {
|
||||
h = "error"
|
||||
}
|
||||
return map[string]string{"ready": ready, "os": n.Status.NodeInfo.OSImage, "kubelet": n.Status.NodeInfo.KubeletVersion, "health": h}
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
@@ -452,8 +583,7 @@ func handleResource(w http.ResponseWriter, r *http.Request) {
|
||||
// reusing the same ownerReferences-walking logic buildGraph uses for the
|
||||
// schedules-on edges -- so "which pods back this node" stays consistent
|
||||
// with what the graph already shows for placement.
|
||||
func podsForWorkload(ctx context.Context, ns, kind, name string) ([]corev1.Pod, error) {
|
||||
target := workloadID(ns, kind, name)
|
||||
func podsForWorkload(ctx context.Context, ns, target string) ([]corev1.Pod, error) {
|
||||
pods, err := clientset.CoreV1().Pods(ns).List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -480,14 +610,13 @@ type PodInfo struct {
|
||||
// logs, since a Deployment/StatefulSet/DaemonSet/CronJob isn't itself a log
|
||||
// source, its pods are.
|
||||
func handlePods(w http.ResponseWriter, r *http.Request) {
|
||||
kind := r.URL.Query().Get("kind")
|
||||
id := r.URL.Query().Get("id")
|
||||
ns := r.URL.Query().Get("namespace")
|
||||
name := r.URL.Query().Get("name")
|
||||
if kind == "" || ns == "" || name == "" {
|
||||
http.Error(w, "kind, namespace and name are required", http.StatusBadRequest)
|
||||
if ns == "" || !strings.HasPrefix(id, "wl/"+ns+"/") {
|
||||
http.Error(w, "namespace and a workload id (wl/<ns>/<kind>/<name>) are required", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
pods, err := podsForWorkload(r.Context(), ns, kind, name)
|
||||
pods, err := podsForWorkload(r.Context(), ns, id)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
--bg: light-dark(#f4f5f7, #0f1115);
|
||||
--panel: light-dark(#ffffff, #161920);
|
||||
--panel-2: light-dark(#f0f2f5, #1c2029);
|
||||
--line: light-dark(#d9dde3, #2a2f3a);
|
||||
--text: light-dark(#1d2129, #e3e6eb);
|
||||
--muted: light-dark(#5d6573, #98a1b0);
|
||||
--accent: light-dark(#2f6fe0, #6aa0ff);
|
||||
--accent-soft: light-dark(#e3edfd, #1d2a44);
|
||||
--ok: light-dark(#1f9d55, #3fcf7f);
|
||||
--warn: light-dark(#c98200, #f0b429);
|
||||
--error: light-dark(#d33a3a, #ff6b6b);
|
||||
--idle: light-dark(#8a93a3, #6b7383);
|
||||
--focus: light-dark(#2f6fe0, #8fb8ff);
|
||||
accent-color: var(--accent);
|
||||
scrollbar-color: light-dark(#b9c0cb, #3a4150) transparent;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; height: 100%; }
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font: 0.8125rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.muted { color: var(--muted); }
|
||||
.small { font-size: 0.75rem; }
|
||||
|
||||
:where(button, input, select, [role="treeitem"], [role="tab"]):focus-visible {
|
||||
outline: 2px solid var(--focus);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: var(--panel-2);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 6px;
|
||||
padding: 0.25rem 0.6rem;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn:hover { border-color: var(--muted); }
|
||||
.btn.icon { width: 2rem; height: 2rem; padding: 0; font-size: 1rem; line-height: 1; }
|
||||
select, input[type="search"] {
|
||||
background: var(--panel-2);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 6px;
|
||||
padding: 0.3rem 0.5rem;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
/* top bar */
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 0.5rem 0.9rem;
|
||||
background: var(--panel);
|
||||
border-bottom: 1px solid var(--line);
|
||||
flex: none;
|
||||
}
|
||||
.brand { font-weight: 650; letter-spacing: 0.01em; }
|
||||
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; flex: 1; min-width: 0; }
|
||||
.crumbs button {
|
||||
background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0.1rem 0.2rem; border-radius: 4px;
|
||||
}
|
||||
.crumbs .sep { color: var(--muted); }
|
||||
.crumbs .chip {
|
||||
display: inline-flex; align-items: center; gap: 0.25rem;
|
||||
background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: 0.05rem 0.25rem 0.05rem 0.6rem;
|
||||
}
|
||||
.crumbs .chip button { color: var(--muted); padding: 0 0.35rem; }
|
||||
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; flex: none; }
|
||||
.toggle { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
|
||||
|
||||
/* main layout */
|
||||
.layout { flex: 1; display: flex; min-height: 0; }
|
||||
.sidebar {
|
||||
width: 19rem; flex: none;
|
||||
display: flex; flex-direction: column; gap: 0.6rem;
|
||||
padding: 0.75rem;
|
||||
background: var(--panel);
|
||||
border-right: 1px solid var(--line);
|
||||
min-height: 0;
|
||||
}
|
||||
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; }
|
||||
.seg [role="tab"] {
|
||||
flex: 1; border: none; background: none; color: var(--muted); font: inherit; padding: 0.3rem; border-radius: 5px; cursor: pointer;
|
||||
}
|
||||
.seg [role="tab"][aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px #0002; }
|
||||
.hint { margin: 0; color: var(--muted); font-size: 0.72rem; }
|
||||
|
||||
/* inventory tree */
|
||||
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
|
||||
.tree { flex: 1; overflow-y: auto; min-height: 0; padding-right: 2px; }
|
||||
.tree ul { padding-left: 0.9rem; }
|
||||
.tree [role="treeitem"] > .row {
|
||||
display: flex; align-items: center; gap: 0.35rem;
|
||||
padding: 0.18rem 0.35rem; border-radius: 5px; cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tree [role="treeitem"] > .row:hover { background: var(--panel-2); }
|
||||
.tree [role="treeitem"][aria-selected="true"] > .row { background: var(--accent-soft); }
|
||||
.tree [role="treeitem"].in-scope > .row .label { font-weight: 600; }
|
||||
.tree [role="treeitem"]:focus-visible { outline: none; }
|
||||
.tree [role="treeitem"]:focus-visible > .row { outline: 2px solid var(--focus); outline-offset: -2px; }
|
||||
.tree [role="treeitem"][aria-expanded="false"] > ul { display: none; }
|
||||
.tree .twisty { width: 0.9rem; flex: none; color: var(--muted); text-align: center; font-size: 0.65rem; }
|
||||
.tree [aria-expanded="true"] > .row .twisty::before { content: "▾"; }
|
||||
.tree [aria-expanded="false"] > .row .twisty::before { content: "▸"; }
|
||||
.tree .icon { width: 14px; height: 14px; flex: none; }
|
||||
.tree .label { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
|
||||
.tree .count { color: var(--muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
|
||||
.tree mark { background: none; color: var(--accent); font-weight: 650; }
|
||||
|
||||
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
|
||||
.dot.ok { background: var(--ok); }
|
||||
.dot.warn { background: var(--warn); }
|
||||
.dot.error { background: var(--error); }
|
||||
.dot.idle { background: var(--idle); }
|
||||
|
||||
/* canvas */
|
||||
.stage { flex: 1; position: relative; min-width: 0; }
|
||||
#cy { position: absolute; inset: 0; }
|
||||
.stage-status {
|
||||
position: absolute; top: 0.6rem; left: 50%; transform: translateX(-50%);
|
||||
background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
|
||||
padding: 0.2rem 0.8rem; font-size: 0.75rem; color: var(--muted);
|
||||
}
|
||||
.stage-status:empty { display: none; }
|
||||
.stage-status.error { color: var(--error); }
|
||||
.zoom { position: absolute; right: 0.75rem; bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
|
||||
.legend {
|
||||
position: absolute; left: 0.75rem; bottom: 0.75rem;
|
||||
display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; max-width: 70%;
|
||||
background: color-mix(in srgb, var(--panel) 88%, transparent);
|
||||
border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.7rem;
|
||||
font-size: 0.72rem; color: var(--muted);
|
||||
}
|
||||
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
|
||||
.legend .line { width: 22px; height: 0; border-top: 2px solid var(--muted); }
|
||||
.legend .line.traffic { border-top: 3px dashed var(--accent); }
|
||||
.legend .line.drop { border-top: 3px dashed var(--error); }
|
||||
.legend .line.config { border-top: 1.5px solid var(--muted); }
|
||||
|
||||
/* details panel */
|
||||
.details {
|
||||
width: 27rem; flex: none;
|
||||
display: flex; flex-direction: column;
|
||||
background: var(--panel);
|
||||
border-left: 1px solid var(--line);
|
||||
min-height: 0;
|
||||
}
|
||||
.details[hidden] { display: none; }
|
||||
.details-head { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.8rem 0.9rem 0.5rem; }
|
||||
.details-title { flex: 1; min-width: 0; }
|
||||
.details-title h2 { margin: 0.2rem 0 0; font-size: 1rem; overflow-wrap: anywhere; }
|
||||
.kind-chip {
|
||||
display: inline-block; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em;
|
||||
padding: 0.05rem 0.45rem; border-radius: 4px; color: #fff;
|
||||
}
|
||||
.tabs { display: flex; gap: 0.2rem; padding: 0 0.9rem; border-bottom: 1px solid var(--line); }
|
||||
.tabs [role="tab"] {
|
||||
border: none; background: none; color: var(--muted); font: inherit;
|
||||
padding: 0.45rem 0.6rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
|
||||
}
|
||||
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
|
||||
.tabs [role="tab"][hidden] { display: none; }
|
||||
.tab-panel { flex: 1; overflow-y: auto; padding: 0.8rem 0.9rem; min-height: 0; }
|
||||
.tab-panel[hidden] { display: none; }
|
||||
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.8rem; margin: 0 0 1rem; }
|
||||
.facts dt { color: var(--muted); }
|
||||
.facts dd { margin: 0; overflow-wrap: anywhere; }
|
||||
.status { display: inline-flex; align-items: center; gap: 0.35rem; }
|
||||
.section-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 1rem 0 0.4rem; }
|
||||
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
|
||||
.link-list button {
|
||||
width: 100%; display: flex; align-items: center; gap: 0.5rem; text-align: left;
|
||||
background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
|
||||
padding: 0.35rem 0.5rem; color: var(--text); font: inherit; cursor: pointer;
|
||||
}
|
||||
.link-list button:hover { border-color: var(--accent); }
|
||||
.link-list .meta { margin-left: auto; color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.link-list .drop { color: var(--error); }
|
||||
.code {
|
||||
margin: 0; white-space: pre; overflow: auto;
|
||||
font: 0.72rem/1.5 ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
|
||||
background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem;
|
||||
}
|
||||
#d-logs { white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.logs-bar { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
|
||||
.logs-bar select { max-width: 100%; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
* { transition: none !important; animation: none !important; }
|
||||
}
|
||||
+1097
File diff suppressed because it is too large
Load Diff
+67
-231
@@ -2,244 +2,80 @@
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<title>cluster-map</title>
|
||||
<script src="https://unpkg.com/cytoscape@3.30.2/dist/cytoscape.min.js"></script>
|
||||
<script src="https://unpkg.com/dagre@0.8.5/dist/dagre.min.js"></script>
|
||||
<script src="https://unpkg.com/cytoscape-dagre@2.5.0/cytoscape-dagre.js"></script>
|
||||
<style>
|
||||
:root { color-scheme: dark; }
|
||||
html, body { margin: 0; height: 100%; background: #0f1115; color: #e6e6e6; font: 13px/1.4 -apple-system, Segoe UI, sans-serif; }
|
||||
#app { display: flex; height: 100%; }
|
||||
#sidebar { width: 260px; flex: none; padding: 12px; border-right: 1px solid #262a33; overflow-y: auto; }
|
||||
#graph { flex: 1; position: relative; }
|
||||
#cy { position: absolute; inset: 0; }
|
||||
#details { width: 420px; flex: none; padding: 12px; border-left: 1px solid #262a33; overflow-y: auto; display: none; }
|
||||
#details.open { display: block; }
|
||||
h1 { font-size: 15px; margin: 0 0 12px; }
|
||||
h2 { font-size: 13px; margin: 0 0 6px; color: #8fb8ff; }
|
||||
label { display: block; margin: 4px 0; cursor: pointer; }
|
||||
input[type=checkbox] { margin-right: 6px; }
|
||||
input[type=text] { width: 100%; box-sizing: border-box; padding: 6px; background: #1a1d24; border: 1px solid #333; color: #eee; border-radius: 4px; margin-bottom: 8px; }
|
||||
pre { white-space: pre-wrap; word-break: break-word; font-size: 11px; background: #14161b; padding: 8px; border-radius: 4px; }
|
||||
.fact { margin: 2px 0; }
|
||||
.fact b { color: #9aa4b2; }
|
||||
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
|
||||
#status { position: absolute; top: 8px; left: 8px; font-size: 11px; color: #666; }
|
||||
button { background: #1a1d24; color: #eee; border: 1px solid #333; border-radius: 4px; padding: 4px 8px; cursor: pointer; margin-bottom: 8px; }
|
||||
button:hover { background: #23262e; }
|
||||
select { background: #1a1d24; color: #eee; border: 1px solid #333; border-radius: 4px; padding: 4px; margin: 0 6px 8px 0; max-width: 100%; }
|
||||
#details-logs { max-height: 320px; overflow-y: auto; background: #0b0c0f; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="app.css">
|
||||
<script src="vendor/cytoscape.min.js"></script>
|
||||
<script src="vendor/elk.bundled.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="sidebar">
|
||||
<h1>cluster-map</h1>
|
||||
<button id="reload">Обновить граф</button>
|
||||
<h2>Namespaces</h2>
|
||||
<label><input type="checkbox" id="show-system"> показать системные (d8-*, kube-*)</label>
|
||||
<input type="text" id="ns-filter" placeholder="фильтр по имени namespace...">
|
||||
<div id="ns-list"></div>
|
||||
<h2 style="margin-top:16px">Легенда</h2>
|
||||
<div class="fact"><span class="legend-swatch" style="background:#4c8bf5"></span>deployment</div>
|
||||
<div class="fact"><span class="legend-swatch" style="background:#7a5cf0"></span>statefulset</div>
|
||||
<div class="fact"><span class="legend-swatch" style="background:#c0567a"></span>daemonset</div>
|
||||
<div class="fact"><span class="legend-swatch" style="background:#9a9a9a"></span>cronjob</div>
|
||||
<div class="fact"><span class="legend-swatch" style="background:#37b37e"></span>service</div>
|
||||
<div class="fact"><span class="legend-swatch" style="background:#e0a800"></span>ingress</div>
|
||||
<div class="fact"><span class="legend-swatch" style="background:#2a2d36;border:1px solid #555"></span>node (физический)</div>
|
||||
<header class="topbar">
|
||||
<div class="brand">cluster-map</div>
|
||||
<nav class="crumbs" id="crumbs" aria-label="Текущий вид"></nav>
|
||||
<div class="topbar-actions">
|
||||
<label class="toggle"><input type="checkbox" id="traffic-on" checked> Трафик</label>
|
||||
<select id="traffic-window" aria-label="Окно трафика">
|
||||
<option value="300">5 мин</option>
|
||||
<option value="900">15 мин</option>
|
||||
<option value="3600">1 час</option>
|
||||
</select>
|
||||
<label class="toggle" title="Проверки kubelet, cilium health, трафик между нодами"><input type="checkbox" id="infra-traffic"> Служебный</label>
|
||||
<button type="button" id="reload" class="btn">Обновить</button>
|
||||
<span class="muted small" id="updated"></span>
|
||||
</div>
|
||||
<div id="graph">
|
||||
<div id="cy"></div>
|
||||
<div id="status">загрузка...</div>
|
||||
</header>
|
||||
|
||||
<div class="layout">
|
||||
<aside class="sidebar" aria-label="Инвентарь">
|
||||
<div class="seg" role="tablist" aria-label="Группировка">
|
||||
<button type="button" role="tab" id="view-ns" aria-selected="true" aria-controls="tree">Namespaces</button>
|
||||
<button type="button" role="tab" id="view-nodes" aria-selected="false" aria-controls="tree">Ноды</button>
|
||||
</div>
|
||||
<div id="details">
|
||||
<button id="close-details">закрыть</button>
|
||||
<h2 id="details-title"></h2>
|
||||
<div id="details-facts"></div>
|
||||
<div id="details-logs-section" style="display:none">
|
||||
<h2>Логи</h2>
|
||||
<select id="pod-select"></select>
|
||||
<select id="container-select"></select>
|
||||
<button id="load-logs">Обновить логи</button>
|
||||
<pre id="details-logs"></pre>
|
||||
<input type="search" id="tree-filter" placeholder="Поиск: имя, namespace, образ…" aria-label="Поиск по инвентарю">
|
||||
<ul class="tree" id="tree" role="tree" aria-label="Объекты кластера"></ul>
|
||||
<p class="hint">Клик — открыть на карте. Ctrl+клик по namespace — добавить к текущему виду.</p>
|
||||
</aside>
|
||||
|
||||
<main class="stage">
|
||||
<div id="cy" aria-label="Карта"></div>
|
||||
<div class="stage-status" id="stage-status" role="status" aria-live="polite"></div>
|
||||
<div class="zoom" role="group" aria-label="Масштаб">
|
||||
<button type="button" class="btn icon" id="zoom-in" aria-label="Приблизить">+</button>
|
||||
<button type="button" class="btn icon" id="zoom-out" aria-label="Отдалить">−</button>
|
||||
<button type="button" class="btn icon" id="zoom-fit" aria-label="Показать всё">⤢</button>
|
||||
</div>
|
||||
<h2>Манифест</h2>
|
||||
<pre id="details-yaml">загрузка...</pre>
|
||||
<div class="legend" id="legend"></div>
|
||||
</main>
|
||||
|
||||
<aside class="details" id="details" aria-label="Детали объекта" hidden>
|
||||
<div class="details-head">
|
||||
<div class="details-title">
|
||||
<span class="kind-chip" id="d-kind"></span>
|
||||
<h2 id="d-name"></h2>
|
||||
<div class="muted small" id="d-sub"></div>
|
||||
</div>
|
||||
<button type="button" class="btn icon" id="d-close" aria-label="Закрыть панель">×</button>
|
||||
</div>
|
||||
<script>
|
||||
const KIND_COLOR = {
|
||||
deployment: '#4c8bf5', statefulset: '#7a5cf0', daemonset: '#c0567a', cronjob: '#9a9a9a',
|
||||
service: '#37b37e', ingress: '#e0a800', node: '#2a2d36',
|
||||
};
|
||||
const KIND_SHAPE = {
|
||||
deployment: 'round-rectangle', statefulset: 'round-rectangle', daemonset: 'round-rectangle', cronjob: 'round-rectangle',
|
||||
service: 'ellipse', ingress: 'diamond', node: 'hexagon',
|
||||
};
|
||||
|
||||
let fullGraph = { nodes: [], edges: [] };
|
||||
let cy;
|
||||
let currentNode = null;
|
||||
const WORKLOAD_KINDS = new Set(['deployment', 'statefulset', 'daemonset', 'cronjob']);
|
||||
|
||||
async function loadGraph() {
|
||||
document.getElementById('status').textContent = 'загрузка...';
|
||||
const resp = await fetch('/api/graph');
|
||||
fullGraph = await resp.json();
|
||||
document.getElementById('status').textContent = `${fullGraph.nodes.length} узлов, ${fullGraph.edges.length} рёбер`;
|
||||
buildNsList();
|
||||
render();
|
||||
}
|
||||
|
||||
function buildNsList() {
|
||||
const el = document.getElementById('ns-list');
|
||||
const showSystem = document.getElementById('show-system').checked;
|
||||
const filterText = document.getElementById('ns-filter').value.toLowerCase();
|
||||
const namespaces = fullGraph.nodes.filter(n => n.kind === 'namespace');
|
||||
el.innerHTML = '';
|
||||
namespaces
|
||||
.filter(n => (showSystem || n.facts.system !== 'true') && n.label.toLowerCase().includes(filterText))
|
||||
.sort((a, b) => a.label.localeCompare(b.label))
|
||||
.forEach(n => {
|
||||
const id = 'ns-cb-' + n.label;
|
||||
const lbl = document.createElement('label');
|
||||
lbl.innerHTML = `<input type="checkbox" class="ns-cb" data-ns="${n.label}" id="${id}" checked> ${n.label}`;
|
||||
el.appendChild(lbl);
|
||||
});
|
||||
el.querySelectorAll('.ns-cb').forEach(cb => cb.addEventListener('change', render));
|
||||
}
|
||||
|
||||
function selectedNamespaces() {
|
||||
return new Set([...document.querySelectorAll('.ns-cb:checked')].map(cb => cb.dataset.ns));
|
||||
}
|
||||
|
||||
function render() {
|
||||
const selected = selectedNamespaces();
|
||||
const visibleNodeIds = new Set();
|
||||
const elements = [];
|
||||
|
||||
fullGraph.nodes.forEach(n => {
|
||||
if (n.kind === 'namespace') {
|
||||
if (!selected.has(n.label)) return;
|
||||
} else if (n.kind === 'node') {
|
||||
// physical nodes are always shown -- they're the "where" layer, not namespaced
|
||||
} else {
|
||||
if (n.namespace && !selected.has(n.namespace)) return;
|
||||
}
|
||||
visibleNodeIds.add(n.id);
|
||||
elements.push({
|
||||
group: 'nodes',
|
||||
data: {
|
||||
id: n.id, label: n.label, kind: n.kind, parent: n.kind === 'node' ? undefined : n.parent,
|
||||
color: KIND_COLOR[n.kind] || '#666', shape: KIND_SHAPE[n.kind] || 'ellipse',
|
||||
namespace: n.namespace, facts: n.facts,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
fullGraph.edges.forEach(e => {
|
||||
if (!visibleNodeIds.has(e.source) || !visibleNodeIds.has(e.target)) return;
|
||||
elements.push({ group: 'edges', data: { id: e.id, source: e.source, target: e.target, kind: e.kind } });
|
||||
});
|
||||
|
||||
if (cy) cy.destroy();
|
||||
cy = cytoscape({
|
||||
container: document.getElementById('cy'),
|
||||
elements,
|
||||
style: [
|
||||
{ selector: 'node[kind = "namespace"]', style: {
|
||||
'background-color': '#1a1d24', 'background-opacity': 0.5, 'border-color': '#333', 'border-width': 1,
|
||||
label: 'data(label)', 'font-size': 11, color: '#8fb8ff', 'text-valign': 'top', 'text-halign': 'left',
|
||||
'padding': '14px', shape: 'round-rectangle',
|
||||
}},
|
||||
{ selector: 'node[kind != "namespace"]', style: {
|
||||
'background-color': 'data(color)', shape: 'data(shape)', label: 'data(label)',
|
||||
'font-size': 10, color: '#fff', 'text-outline-width': 1, 'text-outline-color': '#0009',
|
||||
width: 'label', height: 24, padding: '6px', 'text-valign': 'center',
|
||||
}},
|
||||
{ selector: 'edge[kind = "selects"]', style: { 'line-color': '#37b37e', width: 1.5, 'target-arrow-color': '#37b37e', 'target-arrow-shape': 'triangle', 'curve-style': 'bezier' } },
|
||||
{ selector: 'edge[kind = "routes"]', style: { 'line-color': '#e0a800', width: 1.5, 'target-arrow-color': '#e0a800', 'target-arrow-shape': 'triangle', 'curve-style': 'bezier' } },
|
||||
{ selector: 'edge[kind = "schedules-on"]', style: { 'line-color': '#3a3f4b', width: 1, 'line-style': 'dashed', 'curve-style': 'bezier', 'target-arrow-shape': 'none' } },
|
||||
],
|
||||
layout: { name: 'dagre', rankDir: 'LR', nodeSep: 20, rankSep: 60, animate: false },
|
||||
});
|
||||
|
||||
cy.on('tap', 'node', evt => {
|
||||
const n = evt.target.data();
|
||||
if (n.kind === 'namespace') return;
|
||||
showDetails(n);
|
||||
});
|
||||
}
|
||||
|
||||
async function showDetails(n) {
|
||||
currentNode = n;
|
||||
document.getElementById('details').classList.add('open');
|
||||
document.getElementById('details-title').textContent = `${n.kind}: ${n.label}`;
|
||||
const factsEl = document.getElementById('details-facts');
|
||||
factsEl.innerHTML = Object.entries(n.facts || {}).map(([k, v]) => `<div class="fact"><b>${k}:</b> ${v || '—'}</div>`).join('');
|
||||
const yamlEl = document.getElementById('details-yaml');
|
||||
yamlEl.textContent = 'загрузка манифеста...';
|
||||
const params = new URLSearchParams({ kind: n.kind, namespace: n.namespace || '', name: n.label });
|
||||
const resp = await fetch('/api/resource?' + params);
|
||||
yamlEl.textContent = resp.ok ? await resp.text() : 'не удалось получить манифест: ' + resp.status;
|
||||
|
||||
const logsSection = document.getElementById('details-logs-section');
|
||||
if (!WORKLOAD_KINDS.has(n.kind)) {
|
||||
logsSection.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
logsSection.style.display = 'block';
|
||||
await loadPodPickers(n, params);
|
||||
}
|
||||
|
||||
async function loadPodPickers(n, params) {
|
||||
const podSelect = document.getElementById('pod-select');
|
||||
const containerSelect = document.getElementById('container-select');
|
||||
const logsEl = document.getElementById('details-logs');
|
||||
podSelect.innerHTML = '<option>загрузка подов...</option>';
|
||||
containerSelect.innerHTML = '';
|
||||
logsEl.textContent = '';
|
||||
|
||||
const resp = await fetch('/api/pods?' + params);
|
||||
const pods = resp.ok ? await resp.json() : [];
|
||||
if (currentNode !== n) return; // user clicked a different node while this was in flight
|
||||
|
||||
if (!pods.length) {
|
||||
podSelect.innerHTML = '<option value="">нет живых подов</option>';
|
||||
logsEl.textContent = 'нет подов для этого workload прямо сейчас.';
|
||||
return;
|
||||
}
|
||||
podSelect.innerHTML = pods.map(p => `<option value="${p.name}">${p.name} (${p.phase})</option>`).join('');
|
||||
|
||||
const fillContainers = () => {
|
||||
const p = pods.find(p => p.name === podSelect.value);
|
||||
containerSelect.innerHTML = (p ? p.containers : []).map(c => `<option value="${c}">${c}</option>`).join('');
|
||||
};
|
||||
podSelect.onchange = () => { fillContainers(); fetchLogs(); };
|
||||
containerSelect.onchange = fetchLogs;
|
||||
fillContainers();
|
||||
await fetchLogs();
|
||||
}
|
||||
|
||||
async function fetchLogs() {
|
||||
const pod = document.getElementById('pod-select').value;
|
||||
const container = document.getElementById('container-select').value;
|
||||
const logsEl = document.getElementById('details-logs');
|
||||
if (!pod) return;
|
||||
logsEl.textContent = 'загрузка логов...';
|
||||
const params = new URLSearchParams({ namespace: currentNode.namespace || '', pod, container: container || '' });
|
||||
const resp = await fetch('/api/logs?' + params);
|
||||
logsEl.textContent = resp.ok ? (await resp.text() || '(логи пустые)') : 'не удалось получить логи: ' + resp.status;
|
||||
}
|
||||
|
||||
document.getElementById('load-logs').addEventListener('click', fetchLogs);
|
||||
document.getElementById('reload').addEventListener('click', loadGraph);
|
||||
document.getElementById('close-details').addEventListener('click', () => document.getElementById('details').classList.remove('open'));
|
||||
document.getElementById('show-system').addEventListener('change', () => { buildNsList(); render(); });
|
||||
document.getElementById('ns-filter').addEventListener('input', buildNsList);
|
||||
|
||||
loadGraph();
|
||||
</script>
|
||||
<div class="tabs" role="tablist" aria-label="Разделы">
|
||||
<button type="button" role="tab" data-tab="overview" aria-selected="true">Обзор</button>
|
||||
<button type="button" role="tab" data-tab="links" aria-selected="false">Связи</button>
|
||||
<button type="button" role="tab" data-tab="yaml" aria-selected="false">YAML</button>
|
||||
<button type="button" role="tab" data-tab="logs" aria-selected="false">Логи</button>
|
||||
</div>
|
||||
<section class="tab-panel" data-panel="overview" role="tabpanel"></section>
|
||||
<section class="tab-panel" data-panel="links" role="tabpanel" hidden></section>
|
||||
<section class="tab-panel" data-panel="yaml" role="tabpanel" hidden><pre class="code" id="d-yaml"></pre></section>
|
||||
<section class="tab-panel" data-panel="logs" role="tabpanel" hidden>
|
||||
<div class="logs-bar">
|
||||
<select id="pod-select" aria-label="Под"></select>
|
||||
<select id="container-select" aria-label="Контейнер"></select>
|
||||
<button type="button" class="btn" id="logs-reload">Обновить</button>
|
||||
</div>
|
||||
<pre class="code" id="d-logs"></pre>
|
||||
</section>
|
||||
</aside>
|
||||
</div>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Vendored
+32
File diff suppressed because one or more lines are too long
Vendored
+6696
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user