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.
* kubed.el (kubed-watch-deployment-status): New command.
(kubed-restart-deployment-watch-status): New use option.
(kubed-restart-deployment): Use them.
(deployment): Bind it in prefix map and in list buffer.
* kubed.el (kubed-menu-map): New map with global Kubed menu.
(kubed-menu-bar-mode): New minor mode, adds 'kubed-menu-bar'
to global menu bar.
(kubed-define-resource): Also generate a sub-menu for each
resource type.
(pod, namespace): Adjust.
* kubed-transient.el (kubed-transient-patch): New command.
(kubed-transient): Bind it.
(kubed-transient-apply): Fix capitalization.
* kubed.el (kubed-patch-history): New variable.
(kubed-read-patch): New function.
(kubed-patch): New command.
(kubed-prefix-map): Bind it.
(kubed-define-resource): Add 'kubed-RESOURCEs-patch'
commands that patch the resource at point/mouse in resource
list buffers.
Add argument SILENT to 'kubed-update-RESOURCEs' commands
* kubed.el (kubed-define-resource): Add optional argument
SILENT to generated 'kubed-update-RESOURCEs' commands. Use
it when update is triggered by user initiated operation.
* kubed.el (kubed-api-resources, kubed-resource-names)
(kubed-read-resource-name, kubed-read-resource-type):
New functions.
(kubed-define-resource): Use new 'kubed-resource-names' to
read resource name in different namespace.
(kubed-read-resource-field): Use new 'kubed-api-resources'.