Skip to content

Enhance kubectl command to be more magit like#153

Open
DamianB-BitFlipper wants to merge 15 commits intoabrochard:masterfrom
DamianB-BitFlipper:master
Open

Enhance kubectl command to be more magit like#153
DamianB-BitFlipper wants to merge 15 commits intoabrochard:masterfrom
DamianB-BitFlipper:master

Conversation

@DamianB-BitFlipper
Copy link
Contributor

@DamianB-BitFlipper DamianB-BitFlipper commented Jan 24, 2026

Summary

Major UX and error handling improvements to kubel, including better navigation, improved error visibility, GKE authentication support, and performance optimizations.

Key Changes

Error Handling & Visibility

  • Added header error overlay system - errors now display prominently at the top of the buffer with a clear warning indicator
  • Improved stderr handling with dedicated buffer and logging to process buffer
  • Added automatic GKE authentication error detection with prompt to run gcloud auth login

Navigation & Buffer Management

  • Introduced parent buffer tracking for hierarchical navigation (q now returns to parent buffer)
  • New kubel-list-namespaces command (y) to browse namespaces as a resource list
  • kubel-go-back replaces basic quit behavior with smart parent navigation
  • Added kubel-kill-all-buffers command (Q) to clean up all kubel buffers

Namespace & Context Handling

  • Context namespace caching via kubel--context-namespace-cache to reduce kubectl calls
  • New kubel-set-context-default-namespace command (N) to persist namespace preference in kubectl config
  • Context now lazily initialized on first use (was eagerly loaded at variable definition)
  • When switching contexts, automatically loads the context's default namespace

Selection & Marking UX

  • Mark/unmark now preserves cursor position and advances to next line (dired-like behavior)
  • Selected items now display with dired-marked face across entire row via custom print entry function
  • Mark/unmark operations use tabulated-list-print for efficient partial redraws instead of full refresh

Internal Refactoring

  • Renamed kubel--exec-to-string → kubel--exec-sync with improved semantics
  • Renamed kubel--exec → kubel--exec-async for clarity
  • Resource details buffers now open in same window (pop-to-buffer-same-window)
  • Process buffer display uses display-buffer-below-selected for better layout

New Keybindings

  • y - List namespaces
  • N - Set context default namespace
  • q - Go back to parent buffer
  • Q - Kill all kubel buffers
  • C-c o K - Global keybinding for launching kubel (via new kubel-global-mode)

@DamianB-BitFlipper
Copy link
Contributor Author

unsure why CI is failing with Package emacs-28.1' is unavailable. Exited with code exit status 255`. This doesn't seem related to my code.

@CsBigDataHub
Copy link

waiting for this forever

q - Go back to parent buffer
Q - Kill all kubel buffers

should close #36

Hi @abrochard, any chance of getting this pushed, thank you.

@DamianB-BitFlipper
Copy link
Contributor Author

Love to see it is useful to someone else ❤️

@CsBigDataHub
Copy link

CsBigDataHub commented Feb 13, 2026

Hello @DamianB-BitFlipper , I tested your code, I use kubel-evil and I get this error just by calling M-x kubel

Debugger entered--Lisp error: (void-variable kubel-log-popup:--tail)
  byte-code("\306\10\307\310\311\312\313\314\315\316\317&\n\210\320\11\307\321\322\323%\210\320\n\307\324\325$\210\320\13\307\326\327\330%\210\320\f\307\331\332\333%\210\320\15\307\334\335$\207" [kubel-log-popup:--tail kubel-log-popup kubel-copy-popup kubel-delete-popup kubel-describe-popup kubel-help-popup define-infix-argument nil :description "Tail" :class transient-option :shortarg "-n" :argument "--tail=" define-transient-command "Kubel Log Menu" ["Arguments" ("-f" "Follow" "-f") ("-p" "Previous" "-p") (kubel-log-popup:--tail)] ["Actions" ("l" "Tail pod logs" kubel-get-pod-logs)] "Kubel Copy Menu" ["Actions" ("c" "Copy pod name" kubel-copy-pod-name) ("l" "Copy pod log command" kubel-copy-log-command) ("p" "Copy command prefix" kubel-copy-command-prefix)] "Kubel Delete menu" ["Arguments" ("-f" "Force" "--force --grace-period=0")] ["Actions" ("k" "Delete pod" kubel-delete-pod)] "Kubel Describe Menu" ["Arguments" ("-y" "Yaml" "-o yaml")] ["Actions" ("d" "Deployment" kubel-describe-deployment) ("s" "Service" kubel-describe-service) ("j" "Job" kubel-describe-job) ("i" "Ingress" kubel-describe-ingress) ("c" "Configmap" kubel-describe-configmaps)] "Kubel Menu" ["Actions" ("ENTER" "Pod details" kubel-get-pod-details) ("C" "Set context" kubel-set-context) ("n" "Set namespace" kubel-set-namespace) ("g" "Refresh" kubel-mode) ("p" "Port forward" kubel-port-forward-pod) ("l" "Logs" kubel-log-popup) ("c" "Copy" kubel-copy-popup) ("d" "Describe" kubel-describe-popup) ("e" "Exec" kubel-exec-pod) ("k" "Delete" kubel-delete-popup) ("j" "Jab" kubel-jab-deployment)]] 11)
  command-execute(kubel record)
  #<subr execute-extended-command>(nil "kubel" "kube")
  apply(#<subr execute-extended-command> (nil "kubel" "kube"))
  execute-extended-command(nil "kubel" "kube")
  funcall-interactively(execute-extended-command nil "kubel" "kube")
  command-execute(execute-extended-command)

@abrochard
Copy link
Owner

Hi @DamianB-BitFlipper , sorry for the delay and thank you for submitting this!

Several points:

  1. I don't use k8s in my day to day anymore so testing is a bit of a hassle, so it will take some time to review carefully (thank you @CsBigDataHub for testing it in the meantime)
  2. That's a lot of code and commits that do a lot of different things. If you are so inclined, it would be preferable to break up into smaller per-feature PR (also will help identify & revert if a bug is detected)
  3. I will look into the CI. It's unrelated from your code

@DamianB-BitFlipper
Copy link
Contributor Author

I made a bunch of PRs: https://github.com/DamianB-BitFlipper/kubel/pulls?q=sort%3Aupdated-desc+is%3Apr+is%3Aopen

and the first one in to your master is: #154

We can merge them in from my fork in to yours one by one if they pass your QA.

@abrochard
Copy link
Owner

I made a bunch of PRs: https://github.com/DamianB-BitFlipper/kubel/pulls?q=sort%3Aupdated-desc+is%3Apr+is%3Aopen

and the first one in to your master is: #154

We can merge them in from my fork in to yours one by one if they pass your QA.

Thank you very much! I reviewed and approved the first one

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.

3 participants