Eshel Yaron [Sat, 19 Oct 2024 10:22:43 +0000 (12:22 +0200)]
; Autoload 'kubed-tramp'
Ensure that 'kubed-tramp' is loaded by the time it is
needed, to avoid "Method 'kubedv1' is not known" errors.
Ideally, we'd like to load 'kubed-tramp' on the first
occasion of handling a '/kubedv1:...' remote file name.
However, Tramp does not facilitate loading extensions just
in time. The best we can do is to arrange for 'kubed-tramp'
to be loaded right after Tramp. This is too early, because
Tramp is often used without 'kubed-tramp', so we move some
definitions around so that it no longer pulls in 'kubed'.
See also preceding tramp-devel discussion here:
https://lists.gnu.org/archive/html/tramp-devel/2024-10/msg00005.html
* kubed-common.el: New file.
(kubed-tramp-method, kubed-kubectl-program): Move here from
'kubed' and 'kubed-tramp', respectively.
* kubed-tramp.el: Require 'kubed-common' instead of 'kubed'.
(kubed-tramp-method): Move to 'kubed-common'.
(kubed-tramp-remote-file-name): Remove in favor of new
'kubed-remote-file-name' in 'kubed'.
(kubed-tramp-enable): New function, arrange for it to be
called after 'tramp' is loaded.
* kubed.el: Require 'kubed-common'.
(kubed-kubectl-program): Move to 'kubed-common'.
(kubed-remote-file-name): New function, replaces
'kubed-tramp-remote-file-name'.
(pod): Use it.
Eshel Yaron [Fri, 4 Oct 2024 19:21:30 +0000 (21:21 +0200)]
New user option 'kubed-list-mode-line-format'
* kubed.el (kubed-list-mode-line-format): New user option,
extracted from...
(kubed-define-resource): ...here. Use it in 'mode-name' of
generated major modes. This allows users to customize the indicator
we show in the mode line when update is in progress.
* kubed.texi (Browse Resources): Document new user option.
* NEWS.org: Announce it.
Eshel Yaron [Fri, 4 Oct 2024 19:03:26 +0000 (21:03 +0200)]
Preserve marks in list buffers also in Emacs 29
Instead of relying on
'revert-buffer-restore-functions' (introduced in Emacs 30)
for preserving marks in 'kubed-list-mode' during
'revert-buffer', use a 'revert-buffer-function' to do so.
* kubed.el (kubed-list-revert): New function.
(kubed-list-mode): Use it.
* kubed.el (kubed--proxy-alist): New variable.
(kubed-stop-proxy, kubed-proxy): New commands, use it.
(kubed-prefix-map, kubed-menu-map): Bind 'kubed-proxy'.
* kubed-transient.el (kubed-transient-proxy): New transient.
(kubed-transient): Bind it.
* NEWS.org: Announce new commands.
Eshel Yaron [Fri, 23 Aug 2024 11:20:41 +0000 (13:20 +0200)]
Improve Tramp integration
* kubed-tramp.el: New file.
* kubed.el (kubed--static-if): No longer used, removed.
(kubed-edit-resource): Adapt.
(kubed-pods-dired, kubed-pods-shell): Use new Tramp method.
(kubed-remote-file-name-p): New function.
(kubed-local-context, kubed-local-namespace)
(kubed-local-context-and-namespace): Use it.
Eshel Yaron [Fri, 23 Aug 2024 07:55:30 +0000 (09:55 +0200)]
Improve handling of contexts with no configured namespace
* kubed.el (kubed--namespace): Fallback to prompting when no
default namespace is available.
(kubed-default-context-and-namespace): Prompt for default
namespace when there is none.
(kubed-current-namespace): Clarify that this function may
return nil.
(kubed-read-resource-name): Make CONTEXT argument
non-optional.
(kubed-read-resource-type): Update accordingly.
Eshel Yaron [Wed, 21 Aug 2024 16:46:05 +0000 (18:46 +0200)]
; Fix datetime formatting for '--since-time' argument
* kubed-transient.el
(kubed-transient-read-date): New function.
(kubed-transient-logs-for-resource)
(kubed-transient-logs): Use it.
* kubed.el (kubed-logs): Correct typo.
* kubed-transient.el (kubed-list-transient): Tweak layout;
add type-specific suffixes.
* kubed.el (kubed-list-transient-extra-suffixes): New var.
(kubed-define-resource): Set it to value of new keyword arg
':suffixes'.
(pod, deployment): Specify new keyword arg ':suffixes'.
Eshel Yaron [Tue, 20 Aug 2024 08:56:06 +0000 (10:56 +0200)]
New transient menu 'kubed-transient-logs'
* kubed-transient.el (kubed-transient): Rearrange, delete
duplicate entry, bind 'kubed-transient-logs'.
(kubed-list-transient): Add TODO comment.
* kubed.el (kubed-list-logs): New command.
(kubed-list-create): Mark as specific to 'kubed-list-mode'.
(kubed-list-mode): Tweak comment.
(kubed-define-resource): Add ':logs' keyword argument for
generating 'kubed-logs-for-RESOURCE' commands.
(kubed-logs): Extend with more optional arguments, integrate
with new transient menu.
Eshel Yaron [Thu, 15 Aug 2024 15:06:30 +0000 (17:06 +0200)]
New user option 'kubed-default-context-and-namespace'
* kubed.el (kubed-default-context-and-namespace): New user
option and function of same name.
(kubed-default-context, kubed-default-namespace): New funcs.
(kubed-local-namespace, kubed-local-context)
(kubed-local-context-and-namespace): Use them. Adjust
calls to 'kubed-local-namespace'.
* kubed.texi (Context and Namespace): New section.
Eshel Yaron [Wed, 14 Aug 2024 17:36:33 +0000 (19:36 +0200)]
Teach rollout commands about buffer-local contexts
* kubed-transient.el (kubed-transient-rollout): Add
"--context" infix argument.
* kubed.el (kubed-restart-deployment)
(kubed-watch-deployment-status): Use local context and
namespace. Also add callback argument to 'watch' command.
Eshel Yaron [Wed, 14 Aug 2024 17:29:11 +0000 (19:29 +0200)]
Use buffer-local context in 'kubed-list-*' commands
* kubed.el (kubed-define-resource): Use 'kubed-local-context'
instead of 'kubed-current-context' in generated 'kubed-list-*'
commands, and likewise for the namespace.
Eshel Yaron [Wed, 14 Aug 2024 16:14:54 +0000 (18:14 +0200)]
; Fix errors in last commit
* kubed.el (kubed-create-namespace, kubed-create): Restore
'interactive'.
(kubed-create-deployment): Use 'kubed-update', not
'kubed-list-update', in case we're called from other buffer.
Eshel Yaron [Wed, 7 Aug 2024 15:33:11 +0000 (17:33 +0200)]
New commands for editing displayed resources
* kubed.el (kubed-display-resource-diff)
(kubed-display-resource-replace): New commands.
(kubed-display-resource-mode-map): Bind them.
(kubed-display-config): Fix typo.
(kubed-diff): Learn to use a buffer as DEFINITION.
* kubed.texi (Display Resource): Document new commands.
* NEWS.org: Mention it.
Eshel Yaron [Tue, 6 Aug 2024 15:45:40 +0000 (17:45 +0200)]
; New command 'kubed-list-create'
* kubed.el (kubed-list-create): New command.
(kubed-list-mode-map): Bind it.
(kubed-define-resource): Use it to simplify generated
'kubed-create-*' commands.
Eshel Yaron [Tue, 6 Aug 2024 14:59:25 +0000 (16:59 +0200)]
New command 'kubed-list-fit-column-width-to-content'
* kubed.el (kubed-list-column-number-at-point): New function.
(kubed-list-fit-column-width-to-content): New command.
(kubed-list-mode-map): Bind it.
* kubed.texi (Browse Resources): Document it.
Eshel Yaron [Sat, 3 Aug 2024 15:05:27 +0000 (17:05 +0200)]
New transient menu for displaying resources
* kubed-transient.el (kubed-transient-display): New command.
(kubed-transient): Bind it.
* kubed.el (kubed-display-resource-short-description)
(kubed-namespaced-p): New functions.
(kubed-display-resource): New command, use them.
(kubed-display-resource-handle-bookmark)
(kubed-display-resource-make-bookmark): Simplify.
(kubed-define-resource): Adjust generated
'kubed-display-RESOURCE' commands to honor namespace set in
'kubed-transient-display'. Change binding of these commands
from suffix "g" to suffix "RET".
(kubed-api-resources): Add optional arg ONLY-NAMESPACED.
(kubed-prefix-map, kubed-menu-map): Bind 'kubed-define-resource'.
Eshel Yaron [Fri, 2 Aug 2024 20:55:27 +0000 (22:55 +0200)]
New command 'kubed-display-resource-jump-to-list'
* kubed.el (kubed-display-resource-jump-to-list): New command.
(kubed-display-resource-p): New function, use it as
'completion-predicate' property of new command.
(kubed-display-resource-mode-map): Bind new command.
Eshel Yaron [Fri, 2 Aug 2024 20:00:28 +0000 (22:00 +0200)]
Support bookmarking Kubernetes resource buffers
* kubed.el (kubed-display-resource-info): New variable.
(kubed-display-resource-revert)
(kubed-display-resource-in-buffer)
(kubed-display-resource-handle-bookmark)
(kubed-display-resource-make-bookmark): New functions.
(kubed-display-resource-mode): New minor mode, enabled in
buffers that display resources in YAML format.
(kubed-define-resource): Use 'kubed-display-resource-in-buffer'
in definition of generated 'kubed-RESOURCE-description-buffer'.
Eshel Yaron [Fri, 2 Aug 2024 17:21:56 +0000 (19:21 +0200)]
New commands that run kubectl with resource at point as arg
* kubed.el (kubed-define-resource): Also generate
'kubed-RESOURCEs-kubectl-command' command and bind it to "!"
in resource list buffers.
(kubed-read-kubectl-command): New function, extracted from..
(kubed-kubectl-command): ...here.
Eshel Yaron [Fri, 2 Aug 2024 14:33:45 +0000 (16:33 +0200)]
New user option 'kubed-list-filter-operator-alist'
* kubed.el (kubed-list-filter-operator-alist): New option.
(kubed-list-interpret-atomic-filter)
(kubed-list-validate-atomic-filter): Use it instead of hardcoding
operators "=" and "~".
(kubed-list-set-filter): Adjust docstring.
Eshel Yaron [Thu, 1 Aug 2024 19:03:07 +0000 (21:03 +0200)]
Enhance 'kubed-list-read-filter'
Add in-minibuffer feedback for invalid filters and completion for
column names and column values.
* kubed.el (kubed-list-validate-atomic-filter)
(kubed-list-validate-filter): Refine validation.
(kubed--list-read-filter-target-buffer): New local var.
(kubed-list-try-read-filter): New command.
(kubed-list-read-filter-map): New keymap.
(kubed-list-read-filter): Use it, add completion support.
Eshel Yaron [Thu, 1 Aug 2024 15:45:06 +0000 (17:45 +0200)]
New command 'kubed-list-set-filter' in list buffers
* kubed.el: (kubed-list-filter-history-variable)
(kubed-list-filter): New buffer-local variables.
(kubed-list-interpret-atomic-filter)
(kubed-list-interpret-filter)
(kubed-list-validate-atomic-filter)
(kubed-list-validate-filter)
(kubed-list-read-filter): New functions.
(kubed-list-set-filter): New command.
(kubed-list-mode-map): Bind it.
(kubed-define-resource): Use it.
* kubed-transient.el (kubed-transient-rollout): New command.
(kubed-transient): Bind it.
* kubed.el (kubed-watch-deployment-status)
(kubed-restart-deployment): Use namespace argument from
transient when specified.