ktop Release v0.6.0
ktop v0.6.0 introduces Kubernetes Pressure Stall Information (PSI) resource contention metrics, a dedicated user session directory with rotated logging (~/.ktop/), dynamic in-app table column selection and configuration persistence (~/.ktop/config.yaml), interactive column sorting and filtering across subpages, major Prometheus scraper and metric store performance optimizations, codebase modernization, and toolchain upgrade to Go 1.27.
PSI (Pressure Stall Information) Metrics
- Resource Contention Signals: Integrated cAdvisor/kubelet PSI metrics (
container_pressure_cpu_waiting_seconds_total,container_pressure_memory_waiting_seconds_total,container_pressure_io_waiting_seconds_total) across node and pod workloads. - Overview STALL Column: Added a
STALLcolumn to Nodes and Pods overview tables rendering the dominant waiting stall percentage (CPU, Memory, or I/O) over the scrape window. - Cluster Summary Stall Gauge: Added cluster-level PSI stall metrics to the Cluster Summary header.
- Version Guardrails: Added runtime version checks that surface
⚠ PSI betain the cluster header when Kubernetes is <1.36 and prefix STALL values with⚠ 0%when node kernels are <4.20.
User Session Directory & Rotated Logging (~/.ktop/)
- Session Directory: Introduced automatic creation of
~/.ktop/(mode 0700) for user-specific data, relocatable via the$KTOP_DIRenvironment variable. - Rotated Structured Logging: Integrated
log/slogandlumberjack.v2writing to~/.ktop/ktop.log(mode 0600) with automatic 10MB rotation, retaining the last 3 sessions without interfering with the terminal display. - CLI Logging Flags: Added
--log-level(debug,info,warn,error) and--log-format(text,json) flags. - Graceful Degradation: Application continues running cleanly if directory or file creation fails due to restrictive filesystem permissions.
Dynamic Column Configuration & Persistence (~/.ktop/config.yaml)
- Interactive Column Selector Modal: Added interactive column selection dialog triggered via the
=hotkey on focused overview tables, supporting Space toggle, Enter apply, and Esc cancel. - Active Default Columns: Enforced compact default column layouts for Nodes (
NAME,STATUS,RST,PODS,DISK,CPU,MEM) and Pods (NAMESPACE,POD,READY,STATUS,RST,AGE,CPU,MEMORY), preventing horizontal table sprawling on standard terminals unless explicitly requested with--show-all-columns. - Configuration Schema: Introduced
~/.ktop/config.yamlsupporting table column customizations with resolved defaults for metrics collection and logging. - Automatic Persistence: Column selections passed via CLI flags (
--node-columns,--pod-columns) or modified via the interactive modal automatically persist to~/.ktop/config.yaml. - Modal Event Isolation: Isolated modal input capture so dismissing the column dialog with
Escrestores table focus without triggering application-level exit.
Subpage Navigation, Sorting & UI Consolidation
- Shared Table Controller: Extracted reusable
ui.TableControllerencapsulating sort toggling, shortcut key binding, slash/filter lifecycle, and scroll titles. - Node Detail Pods Sorting & Filtering: Enabled interactive column sorting (
cCPU,mMEM,nNAMESPACE,pPOD,sSTATUS,rRESTARTS,dREADY,aAGE) and/slash filtering on the Node Detail Pods table. - Header Shortcut Collision Fix: Renamed Node Detail Pods second column from
NAMEtoPOD, matching the Overview page and fixing the hotkey collision on'N'withNAMESPACE. - Format Consolidation: Unified detail formatting utilities (
FormatCPU,FormatMemory,FormatDuration,FormatEventAge,Truncate,AdaptiveRateMax,CycleFocus) intoui/format.go.
Performance & Scraper Optimizations
-
Scraper Loop Deduplication: Eliminated duplicate background scrape goroutines in
KubernetesScraper, halving proxy scrape traffic to node kubelets and cAdvisor endpoints. -
O(S) Pod Metrics Aggregation: Rewrote
GetAllPodMetricsfrom an $O(N_{\text{ns}} \times N_{\text{pods}} \times N_{\text{series}})$ Cartesian scan into a single-pass $O(S)$ aggregation grouped by(namespace, pod, container). - Node Metric Query Deduplication: Reused existing node metrics during overview and summary refresh cycles to avoid duplicate queries.
-
Pod-to-Node Indexing: Pre-indexed pods by
Spec.NodeNamein $O(P)$ when constructing node models. - Sparkline Memory Leak Fix: Added automatic eviction of deleted pods and nodes from memory sparkline maps.
-
InitContainer Metric Correctness: Corrected CPU request accounting in
GetPodContainerSummaryfor pods configured with init containers. - Informer Resilience & RBAC Fallback: Replaced background informer sync panics with graceful error recovery, supporting namespace-scoped RBAC clusters.
- TUI Concurrency Deadlock Fix: Switched refresh queue delivery to non-blocking sends and debounced filter inputs to eliminate UI freezes.
Codebase Simplification & Toolchain Modernization
- Dead Code Removal: Removed unused
views/pod/logs.goand deprecated metrics informer/lister infrastructure ink8s/. - Direct Metric Summation: Eliminated redundant
v1beta1.PodMetricsround-trip conversion inMainPanel.refreshPods. - Go 1.27 Toolchain: Upgraded module toolchain to Go 1.27 across
go.mod,Dockerfile, and GitHub Actions workflows. - Standard Library Idioms: Modernized codebase to use
slices.Sort,slices.Contains,slices.Clone, and standardized error wrapping with%w. - Multi-OS CI Matrix: Expanded GitHub Actions CI test suite to validate builds and tests across Linux, macOS, and Windows (
windows-latest).