Repository navigation
feat: node CPU and memory usage metrics - #56
Merged
Merged
Conversation
One-click handoff from the context picker to the user's own terminal: the shell stages a single-context kubeconfig in a 0600 temp file and opens the user's terminal (iTerm2, WezTerm, Kitty, Ghostty, then Terminal.app) with KUBECONFIG pointing at it, a banner naming the context, and an interactive shell. - core: POST /v1/contexts/export narrows the merged kubeconfig to exactly the requested context (same first-wins precedence as listing and connecting) and returns the YAML to the shell only. - shell: new terminal module owns detection (bundle existence plus CLI binaries on PATH), staging (0700 dir, 0600 files, random names), exit cleanup of registered files, and a startup sweep of leftovers from crashed runs. Launches are fire-and-forget with null stdio; no terminal output flows back and no kubectl command is wrapped. - renderer: "Open kubectl" action in the picker footer, disabled with an explanatory tooltip when no local kubectl is found (probed via `kubectl version --client`; aster never installs or downloads one). Only the context id crosses renderer -> shell; kubeconfig contents never reach the renderer and are never logged. macOS only in this release; Windows and Linux are out of scope.
Upgrading a release required typing a chart version blind. The core now serves GET /v1/helm/chart-versions: it fetches the repository index through the helm getters (credentials from the user's repositories.yaml, anonymous for unconfigured URLs, matching the upgrade path), parses the entries for the chart and returns the newest 100 versions in descending semver order with version, appVersion, created and description. Unknown charts answer with the not-found envelope; unreachable or invalid repositories and indexes return clear errors; the lookup is stateless. The upgrade dialog's version input becomes a combobox over that list: keyboard-first (arrows move/open, Enter picks, Escape dismisses the list, typing filters), showing version, appVersion and age. When the list cannot be loaded the field degrades to manual entry with a notice, so an offline or private repository never blocks an upgrade.
Cordoning a node for maintenance previously meant hand-editing spec.unschedulable, and safely emptying it meant a terminal outside the app. The core now owns both operations: - POST /v1/nodes/cordon flips spec.unschedulable through a strategic merge patch, reporting whether the node actually changed. - POST /v1/nodes/drain cordons first (kubectl parity), classifies every pod against the kubectl drain blockers, then evicts through the eviction API so PodDisruptionBudgets are enforced server-side; progress streams as ndjson (per-pod evicting/evicted/failed/skipped events, PDB-blocked retries with capped backoff, final summary). The desktop shell forwards the endpoints through the DesktopApi allowlist and the node detail page gains Cordon/Uncordon (confirmed toggle driven by the live YAML) and a Drain dialog with the four drain options, streaming progress, and journal entries.
Select two or more kubeconfig contexts in the cluster picker and the resource table shows one kind + namespace scope merged across all of them, with a Cluster column marking each row's source. The renderer fans out ordinary single-context list requests and merges the pages client-side; no changes to the Go sidecar or the Rust shell. - ContextPicker gains a multi-select mode (checkboxes, aggregate indication, capped at 8 clusters) beside the unchanged radio flow. - useAggregateResourceList: snapshot-only fan-out per (cluster, namespace) cell, per-cluster degradation with retry, load-more continuing every cluster's next page. - Row identity prefixes the uid with the context id; sourceContextId routes detail, diagnostics, and mutations back to the row's cluster. - Namespace inventory unions the selected clusters; the same scope applies to each (missing namespaces simply return no rows). - Single-cluster behavior is unchanged: one selected context takes the exact previous code path.
The active port-forward list lived only in the renderer's memory, so a reload lost sight of forwards the sidecar still owned and there was no single surface to review or reclaim them. The sidecar is now the source of truth for listing. - core: read-only GET /v1/portforwards (optional contextId filter) that exposes the existing forward registry as sessions with id, contextId, namespace, resourceRef (kind/name), localPort, targetPort, startedAt and the resolved backing pod. Start/stop semantics are unchanged. - desktop: the session read is wired through the DesktopApi allowlist chain (shared types, Tauri invoke adapter, Rust command). - renderer: a toolbar badge counts active forwards across contexts and opens a panel listing every session (cluster, resource, local->target port, age, status) with per-row Stop and a client-side Stop all that reuses the existing stop endpoint. The panel reconciles the sidecar list with the renderer registry: the server wins for known ids, and rows only the sidecar knows (e.g. after renderer state loss) render read-only with a stop. The per-resource Ports tab flow is unchanged.
Resource tables showed a fixed column set per kind, but different teams watch different fields, and for custom resources the useful fields depend entirely on the CRD. This lets each operator choose which columns a kind's table shows and in what order, persisted per kind. - Column picker popover from the resource pane heading: checkbox list of every offered column, per-row up/down buttons, and a keyboard-first flow (Space toggles, ArrowUp/ArrowDown reorders, Escape closes) in line with the rest of the table's roving-tabindex UX. - Per-kind persistence in localStorage (ordered visible ids) following the existing renderer-side preference patterns; Reset to default drops the kind's entry. Unknown kinds and unknown stored ids fall back to the default set, and the table never renders empty. - Extra columns beyond the fixed set: a curated registry of fields the core already projects (images, addresses, ports, RBAC summaries, ...) offered when loaded rows carry data, plus cheap client-side discovery of scalar spec/status fields from the currently loaded rows (capped, deduped, frequency-ranked). Missing values render empty, never error. - The virtualized table renders the dynamic column set through one grid template; summed track floors become a min-width so many columns keep horizontal scrolling working with the header tracking the viewport. Renderer-only: no core/ or shell changes. Covered by unit tests (persistence, derivation/dedup/cap, ordering) and a Playwright smoke test (visibility, reorder, per-kind isolation, persistence across reload, horizontal scroll alignment, reset).
Many production pods run minimal or distroless images without a shell, so there is nothing to exec into when something goes wrong. Add a kubectl-debug-style action that injects an ephemeral debug container into a running pod through the pods/ephemeralcontainers subresource: the workload spec is never modified, the owning deployment never rolls, and the debug container disappears with the pod. - Core: POST /v1/pods/debug builds the ephemeral container entry with kubectl-style defaults (generated unique "debugger-" name when omitted, process-namespace sharing via targetContainer, stdin/tty off) and issues the subresource update through the session manager's typed core clients. Input caps mirror the exec endpoint (bounded argv, env, name/image lengths) at both the RPC boundary and the service. - Desktop: "Add debug container" action on the pod detail page opens a dialog (image defaults to busybox:1.36; optional name, command, target container). Successful injections land in the operation journal, refresh the pod detail, and surface an "Ephemeral debug containers" section under the containers overview. Wired through the DesktopApi allowlist and the Tauri shell like the other pod actions. Tests: Go unit tests with the fake clientset cover append semantics, generated naming, target/env passthrough, duplicate names, missing pods and subresource rejection; rpc tests cover the endpoint and validation; renderer smoke suite covers the dialog flow end to end.
Add real-time node usage alongside the existing pod usage metrics: - Go core: GET /v1/metrics/nodes serves the cluster-scoped metrics.k8s.io nodes snapshot with the same pagination (continue tokens, page cap) and error envelope as the pods endpoint; a missing Metrics Server degrades to the same stable error. - Node rows now project allocatable cpu/memory quantities so the UI can show pressure relative to capacity. - Rust shell: forward metrics_nodes like metrics_pods. - Node table: live CPU/Memory usage columns with humanized values and the share of allocatable, polled every 15s only while the Node list is the active surface. - Node detail: a usage chart (last 5 minutes, 20 samples) reusing the pod chart component via a useNodeMetrics hook.
Deploying aster with
|
| Latest commit: |
819628e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://19ae19dc.aster-7wc.pages.dev |
| Branch Preview URL: | https://feat-node-metrics.aster-7wc.pages.dev |
…w' into HEAD # Conflicts: # apps/desktop/src/renderer/views/ContextPicker.tsx
# Conflicts: # apps/desktop/src/renderer/App.tsx # apps/desktop/tests/renderer-smoke.spec.ts
…into HEAD # Conflicts: # apps/desktop/src-tauri/src/lib.rs # apps/desktop/src/renderer/lib/desktop-tauri.ts # apps/desktop/src/shared/types.ts # apps/desktop/tests/live/shim.ts # apps/desktop/tests/renderer-smoke.spec.ts # core/internal/resources/types.go # core/internal/rpc/server.go
…HEAD # Conflicts: # apps/desktop/src/renderer/App.tsx # apps/desktop/src/renderer/components/ResourceTable.tsx # apps/desktop/tests/renderer-smoke.spec.ts
# Conflicts: # apps/desktop/src/renderer/App.tsx # apps/desktop/src/renderer/detail/resource-actions.ts # apps/desktop/src/renderer/hooks/useMutation.ts # core/internal/rpc/server_test.go
# Conflicts: # apps/desktop/src/renderer/App.tsx # apps/desktop/src/renderer/components/ResourceTable.tsx # apps/desktop/src/shared/types.ts # core/internal/rpc/server_test.go
…HEAD # Conflicts: # apps/desktop/src/renderer/detail/ResourceDetailView.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Node list and Node detail showed only static capacity numbers (allocatable vs. pod requests on the Overview page), so an operator sizing a workload or debugging slowness had no way to see actual node pressure inside Aster. Pods already have live usage; this brings nodes to the same bar and makes usage decisions symmetric across the two surfaces.
What
Go sidecar
GET /v1/metrics/nodes?contextId=...endpoint mirroring the existing pod metrics endpoint: same continue-token pagination with the same page cap, and the same stable error envelope through the shared service error mapping — a cluster without a Metrics Server degrades exactly like the pod metrics surface (404not_foundenvelope), never a bare 500.{name, cpu, memory, window, timestamp}, reusing the pods endpoint's serialization conventions (raw Kubernetes quantity strings plus the aggregation window and sample timestamp).allocatableCpu/allocatableMemoryso the UI can show usage relative to capacity.Rust shell
metrics_nodescommand forwards the new endpoint like the existingmetrics_podspath.Renderer
620m · 16%); polling runs only while the Node list is the active surface.useNodeMetricshook modeled onusePodMetricsand reusing the shared chart component; a missing Metrics Server is a quiet notice with retry, never a spinner.Degradation
Testing
go -C core test ./...andgo -C core vet ./...,pnpm typecheck,pnpm test(163),pnpm build,cargo test+cargo clippy(one pre-existing warning in updater.rs),pnpm --dir apps/desktop smoke:visual(63/63).