Skip to content

feat: watch mode, node/conditions/completion commands, perf optimizations#23

Open
PixiBixi wants to merge 9 commits into
NimbleArchitect:mainfrom
PixiBixi:main
Open

feat: watch mode, node/conditions/completion commands, perf optimizations#23
PixiBixi wants to merge 9 commits into
NimbleArchitect:mainfrom
PixiBixi:main

Conversation

@PixiBixi
Copy link
Copy Markdown

Summary

  • Watch mode (--watch/-w): in-place terminal refresh via Bubble Tea, driven by Kubernetes pod watch events. Metrics commands (cpu/memory/resources) use a 25s ticker since pod events don't fire on metrics changes.
  • kubectl ice node: per-node resource allocation (CPU/memory requests, limits, % of allocatable). Flags: --usage (metrics-server), --compute-class, --overallocated, --class
  • kubectl ice conditions: pod conditions table (PodScheduled, Initialized, ContainersReady, Ready) with status coloring and --watch support
  • kubectl ice completion: shell completion generator for zsh/bash/fish with --install flag
  • Perf: memoryGetUnitLst O(1) lookup, matchFilter pre-parsed values, strings.Builder in table rendering, utf8.RuneCountInString, LeafNode O(1) child map, appendParents append+reverse, GetNamespace kubeconfig cache, GetNodes single List
    for multiple names
  • Color: setColourValue thresholds 0–50% green / 51–75% orange / 76%+ red; COLOUR_MIX suppresses column wheel on plain cells
  • Tests: 33 tests covering setColourValue, pctOf, nodeReadyStatus, nodeRoles, computeNodeAllocations, matchShouldExclude, LeafNode.getChild, Table.Sprint

Test plan

  • go test ./pkg/... passes (33 tests)
  • kubectl ice cpu --watch refreshes in-place, Ctrl+C exits cleanly
  • kubectl ice node displays per-node resource allocation
  • kubectl ice node --usage adds CPU-USED / MEM-USED columns
  • kubectl ice node --overallocated filters over-allocated nodes
  • kubectl ice conditions lists pod conditions
  • kubectl ice conditions -m "STATUS!=True" filters non-ready pods
  • kubectl ice completion zsh --install writes to ~/.zsh/completions/

Add --watch/-w flag to all subcommands. Uses Bubble Tea for in-place
terminal updates driven by Kubernetes pod watch events. Includes
renderFn func() (string, error) pattern adopted by all command handlers.
…tion

Shows CPU/memory requests, limits, and pod count per node as a percentage
of allocatable capacity. Supports --usage (metrics-server), --compute-class,
--overallocated, and --class flags.
Shows all pod conditions (PodScheduled, Initialized, ContainersReady,
Ready) with status, reason, age, and message. Supports --watch and
-m filtering (e.g. -m "STATUS!=True" for non-ready pods).
Generates completion scripts for zsh, bash, and fish. Supports
--install to write directly to the standard system location.
For kubectl plugin integration, symlink kubectl_complete-ice to kubectl-ice.
…atch flag

Wire up all new subcommands (node, conditions, completion) and add the
--watch/-w flag to processCommonFlags for all existing subcommands.
…ric commands

- RowBuilder: add PreBuildFn and RefreshInterval for periodic rebuilds
- Connector: add WatchPods, ClearPodCache, GetAllPodsAllNamespaces, GetMetricNodes
- resources/restarts/status: adopt renderFn pattern with oddities support
- resources: set RefreshInterval=25s and PreBuildFn to re-fetch metrics on watch
- utils: memoryGetUnitLst uses package-level map + O(1) lookup via init()
- builder: matchFilter pre-parses valueInt/valueFloat once in setFilter
- table: replace += string concat with strings.Builder; len([]rune) -> utf8.RuneCountInString
- table: fix COLOUR_MIX to suppress column wheel on plain cells (semantic only)
- utils: update setColourValue thresholds: 0-50% green, 51-75% orange, 76%+ red
- k8sconnector: LeafNode O(1) child lookup, appendParents append+reverse,
  GetNamespace caches kubeconfig read, GetNodes uses List for multiple names
- utils_test: setColourValue thresholds, memoryGetUnitLst, memoryHumanReadable
- builder_test: setFilter pre-parsing, matchShouldExclude (int/string/float/empty)
- node_test: pctOf, nodeReadyStatus, nodeRoles, computeNodeAllocations
- k8sconnector_test: LeafNode.getChild map lookup and deep tree traversal
- table_test: Sprint rendering, hidden columns, unicode alignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant