diff --git a/docs/cluster-watcher.md b/docs/cluster-watcher.md
index 5abb978..72b1107 100644
--- a/docs/cluster-watcher.md
+++ b/docs/cluster-watcher.md
@@ -327,11 +327,20 @@ hide a real outage.
Built on the paged, server-side lists from #69. No page ever lists
everything at once.
-- **Dashboard:** one line per cluster: version, nodes ready of total,
- workloads by state, open incidents. The "needs attention" list takes
- workloads too, capped as for hosts.
-- **Clusters:** each cluster's nodes, operators and update state, then
- its namespaces with counts by state, problems first.
+- **Dashboard:** one line per cluster: its version, state and a summary
+ in its kind's terms: "31/32 nodes ready · 3,300 workloads" for
+ Kubernetes, "2/2 controllers ready · 600 volumes · 71% used" for an
+ array, "CPU 41% · system ASP 85% · 4 of 5 subsystems active" for an
+ IBM i partition. The network map's cluster boxes use the same line.
+ The "needs attention" list takes workloads too, capped as for hosts.
+- **Clusters:** in sections by kind (Kubernetes, Virtualization, Storage,
+ IBM i, Secrets), the ones that need a look first in each, with a jump
+ list counting each kind and its problems. Filters for kind, "need a
+ look" and name stay in the address
+ (`/clusters?group=Storage&show=problems&q=prod`). Each cluster shows
+ its nodes, operators and update state, then its kinds of workload with
+ counts by state. The API gives each cluster's `group` and `summary`.
+ A host's own libvirt or Hyper-V VMs are on its page, not here.
- **Workloads:** one table for every kind, filtered by cluster, namespace,
kind, node and state and searched by name, problems first, paged. The
same table filtered to `vm` is the **VMs** page.
diff --git a/internal/server/mapviews.go b/internal/server/mapviews.go
index 402a817..a52c155 100644
--- a/internal/server/mapviews.go
+++ b/internal/server/mapviews.go
@@ -289,7 +289,7 @@ func (srv *Server) networkView(focus string, now time.Time) (*MapView, bool) {
_, conds := srv.view(now)
for _, c := range srv.clusterViews(now, conds) {
v.Boxes = append(v.Boxes, MapBox{ID: "cluster:" + c.Name, Kind: "cluster", Name: c.Name, Status: c.Status,
- Sub: fmt.Sprintf("%d/%d nodes ready", c.NodesReady, c.Nodes), Count: c.Nodes})
+ Sub: c.Summary, Count: c.Nodes})
}
case "site", "group":
@@ -688,14 +688,18 @@ func (srv *Server) servicesView(focus string, steps int, now time.Time) (*MapVie
where[s.ID] = gid
layer[gid] = min(layer[gid], s.Layer)
}
+ kinds := map[string]string{} // a source's name → what it is, for its box (#37)
+ for _, s := range srv.workloadSnapshot() {
+ kinds[s.name] = s.kindLabel()
+ }
for _, gid := range order {
b := fold(gid, "group", names[gid], members[gid], status)
for i, m := range b.Problems {
b.Problems[i] = svc[m].Name
}
b.Layer = layer[gid]
- if strings.HasPrefix(gid, "group:cluster:") {
- b.Sub = "Kubernetes cluster"
+ if c, ok := strings.CutPrefix(gid, "group:cluster:"); ok {
+ b.Sub = cmp.Or(kinds[c], "Kubernetes cluster")
}
v.Boxes = append(v.Boxes, b)
}
diff --git a/internal/server/workloads.go b/internal/server/workloads.go
index 14bd5b3..0a4ed50 100644
--- a/internal/server/workloads.go
+++ b/internal/server/workloads.go
@@ -552,6 +552,87 @@ func (s wsnap) noun() string {
return "Cluster"
}
+// group is the Clusters page's section for the source (#41).
+func (s wsnap) group() string {
+ switch d := s.distribution(); {
+ case strings.HasPrefix(d, "Vault"), d == "OpenBao":
+ return "Secrets"
+ case strings.HasPrefix(d, "Purity"):
+ return "Storage"
+ case d == ibmiDistribution, d == hmcDistribution:
+ return "IBM i"
+ case d == "vCenter", d == "Prism Central", strings.HasPrefix(d, "Proxmox"):
+ return "Virtualization"
+ }
+ return "Kubernetes"
+}
+
+// kindLabel is what the source is, said on its own: "Kubernetes
+// cluster", "Proxmox cluster", "vCenter", "HMC", "IBM i partition".
+func (s wsnap) kindLabel() string {
+ d := s.distribution()
+ switch n := s.noun(); {
+ case n == "Partition":
+ return "IBM i partition"
+ case n == "Array":
+ return "Pure array"
+ case n != "Cluster":
+ return n // vCenter, Prism Central, HMC, Vault, OpenBao
+ case strings.HasPrefix(d, "Proxmox"):
+ return "Proxmox cluster"
+ case d == "OpenShift", d == "OKD":
+ return d + " cluster"
+ }
+ return "Kubernetes cluster"
+}
+
+// summary is a cluster's state in a line, in the terms of its kind (#46).
+func (v *ClusterView) summary() string {
+ count := func(n int) string { return humanCount(n) }
+ if p := v.Partition; p != nil {
+ var out []string
+ cpu := p.CPUPct
+ if v.Usage != nil && v.Usage.CPUOf > 0 {
+ cpu = &v.Usage.CPUPct // the last minute's, as the page shows
+ }
+ if cpu != nil {
+ out = append(out, fmt.Sprintf("CPU %.0f%%", *cpu))
+ }
+ out = append(out, fmt.Sprintf("system ASP %.0f%%", p.SystemASPPct))
+ if p.Subsystems > 0 {
+ out = append(out, fmt.Sprintf("%d of %d subsystems active", p.SubsystemsActive, p.Subsystems))
+ }
+ return strings.Join(out, " · ")
+ }
+ nodes := strings.ToLower(cmp.Or(v.NodeNoun, "Node")) + "s"
+ out := []string{fmt.Sprintf("%d/%d %s ready", v.NodesReady, v.Nodes, nodes)}
+ switch v.Noun {
+ case "Array":
+ out = append(out, count(v.Workloads)+" volumes")
+ if v.Usage != nil && v.Usage.IO != nil && v.Usage.IO.UsedOf > 0 {
+ out = append(out, fmt.Sprintf("%.0f%% used", 100*float64(v.Usage.IO.Used)/float64(v.Usage.IO.UsedOf)))
+ }
+ case "HMC":
+ out = append(out, count(v.Workloads)+" partitions")
+ case "Vault", "OpenBao":
+ out = append(out, count(v.Workloads)+" certificates")
+ case "vCenter", "Prism Central":
+ out = append(out, count(v.Workloads)+" VMs")
+ default:
+ out = append(out, count(v.Workloads)+" workloads")
+ }
+ return strings.Join(out, " · ")
+}
+
+// humanCount is n with thousands separated: 3,300.
+func humanCount(n int) string {
+ s := strconv.Itoa(n)
+ for i := len(s) - 3; i > 0 && s[i-1] != '-'; i -= 3 {
+ s = s[:i] + "," + s[i:]
+ }
+ return s
+}
+
// nodeNoun is what its nodes are: a FlashArray's are controllers, a
// FlashBlade's blades; a vCenter's and Prism Central's, hosts; an HMC's,
// Power servers.
@@ -1079,6 +1160,12 @@ type ClusterView struct {
NodeNoun string `json:"node_noun"`
// Partition is an IBM i partition's own numbers (docs/ibmi.md).
Partition *PartitionView `json:"partition,omitempty"`
+ // Group is the Clusters page's section: Kubernetes, Virtualization,
+ // Storage, IBM i or Secrets. Summary is one line fitted to the kind,
+ // for the dashboard and the maps: "31/32 nodes ready · 3,300
+ // workloads", "CPU 54% · system ASP 85% · 4 of 5 subsystems active".
+ Group string `json:"group"`
+ Summary string `json:"summary"`
}
// expectSubsystems marks an IBM i partition's subsystems that
@@ -1269,7 +1356,7 @@ func (srv *Server) clusterViews(now time.Time, conds []Condition) []ClusterView
if s.host {
continue // a host's VMs: on its page and Workloads, not Clusters
}
- v := ClusterView{Name: s.name, Agent: s.agent, Problems: probs[s.name], Kinds: map[string]map[string]int{}, Noun: s.noun(), NodeNoun: s.nodeNoun()}
+ v := ClusterView{Name: s.name, Agent: s.agent, Problems: probs[s.name], Kinds: map[string]map[string]int{}, Noun: s.noun(), NodeNoun: s.nodeNoun(), Group: s.group()}
v.Status, v.Word, _ = srv.sourceStatus(s, now)
if !s.heard.IsZero() {
h := s.heard
@@ -1352,6 +1439,7 @@ func (srv *Server) clusterViews(now time.Time, conds []Condition) []ClusterView
if v.Status == "good" && v.Problems > 0 {
v.Status, v.Word = "warning", plural(v.Problems, "problem", "problems")
}
+ v.Summary = v.summary()
out = append(out, v)
}
return out
diff --git a/internal/server/workloads_test.go b/internal/server/workloads_test.go
index 397e80f..4e57057 100644
--- a/internal/server/workloads_test.go
+++ b/internal/server/workloads_test.go
@@ -668,3 +668,49 @@ func TestLowerFirst(t *testing.T) {
}
}
}
+
+// A cluster's summary says what matters for its kind (#46).
+func TestClusterSummary(t *testing.T) {
+ cpu := 41.0
+ cases := []struct {
+ v ClusterView
+ want string
+ }{
+ {ClusterView{Noun: "Cluster", NodeNoun: "Node", Nodes: 32, NodesReady: 31, Workloads: 3300}, "31/32 nodes ready · 3,300 workloads"},
+ {ClusterView{Noun: "Partition", Partition: &PartitionView{CPUPct: &cpu, SystemASPPct: 84.6, Subsystems: 5, SubsystemsActive: 4}}, "CPU 41% · system ASP 85% · 4 of 5 subsystems active"},
+ {ClusterView{Noun: "Array", NodeNoun: "Controller", Nodes: 2, NodesReady: 2, Workloads: 600,
+ Usage: &UsageNow{IO: &report.IO{Used: 71, UsedOf: 100}}}, "2/2 controllers ready · 600 volumes · 71% used"},
+ {ClusterView{Noun: "HMC", NodeNoun: "Server", Nodes: 2, NodesReady: 2, Workloads: 6}, "2/2 servers ready · 6 partitions"},
+ }
+ for _, c := range cases {
+ if got := c.v.summary(); got != c.want {
+ t.Errorf("%s: %q, want %q", c.v.Noun, got, c.want)
+ }
+ }
+ if humanCount(1234567) != "1,234,567" || humanCount(999) != "999" {
+ t.Errorf("humanCount: %s %s", humanCount(1234567), humanCount(999))
+ }
+}
+
+// The service map says what a cluster is, not "Kubernetes cluster" for an
+// HMC or a vCenter (#37); the Clusters page puts each in its section (#41).
+func TestClusterKind(t *testing.T) {
+ snap := func(d string) wsnap {
+ return wsnap{recs: []report.Workload{{Kind: report.KindCluster, ID: report.ClusterSelf, Facts: map[string]any{"distribution": d}}}}
+ }
+ for d, want := range map[string][2]string{
+ "": {"Kubernetes cluster", "Kubernetes"},
+ "OpenShift": {"OpenShift cluster", "Kubernetes"},
+ "Proxmox VE": {"Proxmox cluster", "Virtualization"},
+ "vCenter": {"vCenter", "Virtualization"},
+ "Prism Central": {"Prism Central", "Virtualization"},
+ "HMC": {"HMC", "IBM i"},
+ "IBM i": {"IBM i partition", "IBM i"},
+ "Purity//FA": {"Pure array", "Storage"},
+ "OpenBao": {"OpenBao", "Secrets"},
+ } {
+ if got := [2]string{snap(d).kindLabel(), snap(d).group()}; got != want {
+ t.Errorf("%q: %v, want %v", d, got, want)
+ }
+ }
+}
diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts
index c377c49..459947f 100644
--- a/web/src/lib/api.ts
+++ b/web/src/lib/api.ts
@@ -68,6 +68,8 @@ export interface Cluster {
usage?: Usage; history?: string;
/** What it is (Cluster, Array, vCenter, Prism Central) and what its nodes are (Node, Controller, Host). */
noun: string; node_noun: string;
+ /** The Clusters page's section (Kubernetes, Virtualization, Storage, IBM i, Secrets), and its state in a line, in its kind's terms. */
+ group: string; summary: string;
/** An IBM i partition's own numbers, in place of nodes. */
partition?: PartitionNums;
}
diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte
index 097ae9f..bb261f9 100644
--- a/web/src/routes/+page.svelte
+++ b/web/src/routes/+page.svelte
@@ -111,8 +111,7 @@
{k.name}
Each cluster a cluster agent watches: its nodes, and what runs on them by state. A node that's down is one problem, with what's on it listed under it.
Everything Cairn OBS reads as a cluster, by kind: Kubernetes, hypervisor managers, arrays, IBM i and Vault. The ones that need a look come first in each. A node that's down is one problem, with what's on it listed under it.
{error}
{/if} {#if loaded && clusters.length === 0}No clusters yet. A cluster agent adds its cluster once it has joined.
{/if} -{#each clusters as c (c.name)} +{#if clusters.length} + +None match.
{/if} + {#each x.shown as c (c.name)}Refreshes every 10 seconds.