From b0d48e726ad9f05b729246cb602352d68feaeb79 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 26 Apr 2026 19:56:38 +0200 Subject: [PATCH] update kubed --- elpa/kubed-0.5.0.signed | 1 - elpa/kubed-0.6.1.signed | 1 + elpa/{kubed-0.5.0 => kubed-0.6.1}/.elpaignore | 0 elpa/{kubed-0.5.0 => kubed-0.6.1}/LICENSE | 2 +- elpa/{kubed-0.5.0 => kubed-0.6.1}/NEWS.org | 79 +++ elpa/kubed-0.6.1/README-elpa | 34 ++ .../assets/kubed-deployment-prefix-map.png | Bin .../assets/kubed-list-transient.png | Bin .../assets/kubed-overview.png | Bin .../assets/kubed-prefix-map.png | Bin .../assets/kubed-replace-diff.png | Bin .../assets/kubed-scale-deployments.png | Bin .../assets/kubed-transient-exec.png | Bin .../assets/kubed-transient.png | Bin elpa/{kubed-0.5.0 => kubed-0.6.1}/cobra.el | 2 +- elpa/{kubed-0.5.0 => kubed-0.6.1}/dir | 0 .../kubed-autoloads.el | 144 ++--- .../kubed-common.el | 2 +- .../{kubed-0.5.0 => kubed-0.6.1}/kubed-pkg.el | 4 +- .../kubed-tramp.el | 94 +++- .../kubed-transient.el | 50 +- elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed.el | 524 +++++++++++------- elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed.info | Bin 33602 -> 40905 bytes elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed.texi | 203 ++++++- elpa/kubed-0.6.1/news | 146 +++++ 25 files changed, 974 insertions(+), 312 deletions(-) delete mode 100644 elpa/kubed-0.5.0.signed create mode 100644 elpa/kubed-0.6.1.signed rename elpa/{kubed-0.5.0 => kubed-0.6.1}/.elpaignore (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/LICENSE (99%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/NEWS.org (64%) create mode 100644 elpa/kubed-0.6.1/README-elpa rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-deployment-prefix-map.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-list-transient.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-overview.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-prefix-map.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-replace-diff.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-scale-deployments.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-transient-exec.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/assets/kubed-transient.png (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/cobra.el (99%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/dir (100%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed-autoloads.el (84%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed-common.el (91%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed-pkg.el (60%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed-tramp.el (56%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed-transient.el (90%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed.el (90%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed.info (70%) rename elpa/{kubed-0.5.0 => kubed-0.6.1}/kubed.texi (77%) create mode 100644 elpa/kubed-0.6.1/news diff --git a/elpa/kubed-0.5.0.signed b/elpa/kubed-0.5.0.signed deleted file mode 100644 index 6bef68e9..00000000 --- a/elpa/kubed-0.5.0.signed +++ /dev/null @@ -1 +0,0 @@ -Good signature from 645357D2883A0966 GNU ELPA Signing Agent (2023) (trust undefined) created at 2025-06-11T23:05:01+0200 using EDDSA \ No newline at end of file diff --git a/elpa/kubed-0.6.1.signed b/elpa/kubed-0.6.1.signed new file mode 100644 index 00000000..cff056aa --- /dev/null +++ b/elpa/kubed-0.6.1.signed @@ -0,0 +1 @@ +Good signature from 645357D2883A0966 GNU ELPA Signing Agent (2023) (trust undefined) created at 2026-04-14T11:05:02+0200 using EDDSA \ No newline at end of file diff --git a/elpa/kubed-0.5.0/.elpaignore b/elpa/kubed-0.6.1/.elpaignore similarity index 100% rename from elpa/kubed-0.5.0/.elpaignore rename to elpa/kubed-0.6.1/.elpaignore diff --git a/elpa/kubed-0.5.0/LICENSE b/elpa/kubed-0.6.1/LICENSE similarity index 99% rename from elpa/kubed-0.5.0/LICENSE rename to elpa/kubed-0.6.1/LICENSE index cfd527c4..9934a864 100644 --- a/elpa/kubed-0.5.0/LICENSE +++ b/elpa/kubed-0.6.1/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024-2025 Eshel Yaron + Copyright 2024-2026 Eshel Yaron Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/elpa/kubed-0.5.0/NEWS.org b/elpa/kubed-0.6.1/NEWS.org similarity index 64% rename from elpa/kubed-0.5.0/NEWS.org rename to elpa/kubed-0.6.1/NEWS.org index c8dd79ad..d23a42ff 100644 --- a/elpa/kubed-0.5.0/NEWS.org +++ b/elpa/kubed-0.6.1/NEWS.org @@ -10,6 +10,85 @@ for Kubernetes. For further details, see the Kubed manual: [[https://eshelyaron.com/kubed.html][https://eshelyaron.com/kubed.html]]. +* Version 0.6.1 on 2026-04-13 + +This is a maintenance release, it includes one important bug fix: + +** Fix "Invalid format string" error in Tramp integration + +This version fixes a regression introduced in version 0.6.0, which +caused an error when starting a shell or opening Dired inside a pod. + +See bug report at https://lists.sr.ht/~eshel/kubed-devel/%3C87zf36vqaa.fsf@gmail.com%3E + +* Version 0.6.0 on 2026-04-11 + +** Kubed now uses the remote ~kubectl~ on remote hosts + +When you invoke Kubed commands in a buffer whose ~default-directory~ +points to a directory on a remote host (such as +=/ssh:user@example.com:/some/remote/dir/=), Kubed runs ~kubectl~ on +the remote host, so you can interact with clusters that are configured +in the remote kubeconfig and accessible from the remote host. + +Note that this is a rather extensive change, please tell us about +issues/regressions if you see any! + +** ~kubed-kubectl-program~ is now connection-local + +You can configure different ~kubed-kubectl-program~ values for +different hosts on which you run ~kubectl~ via Kubed commands, by +giving the variable a connection-local value for certain hosts. +For example: + +#+begin_src emacs-lisp +(connection-local-set-profile-variables + 'my-kubed-profile-for-somehost + '((kubed-kubectl-program . "/home/user/my-kubectl"))) + +(connection-local-set-profiles + '(:application kubed :machine "somehost.com") + 'my-kubed-profile-for-somehost) +#+end_src + +** New user option ~kubed-default-context-and-namespace-alist~ + +This user option generalizes and supersedes the existing user option +~kubed-default-context-and-namespace~, which is considered obsolete +but is still available. The new user option lets you set different +defaults depending on the host on which Kubed is running ~kubectl~. + +** Command ~kubed-transient~ is now bound to ~k~ in ~kubed-prefix-map~ + +This was already a recommended binding for this command, which opens +the "root" Kubed transient menu. + +** New user option ~kubed-logs-follow~ + +The new user option ~kubed-logs-follow~ controls whether Kubed follows +new log entries by default when showing Kubernetes logs. +It defaults to ~t~. + +** New user option ~kubed-logs-tail-lines~ + +Kubed commands that show logs for Kubernetes resources now fetch only +the most recent 128 log lines by default, to avoid flooding the logs +buffer with the full history of long-running workloads. You can +customize this limit with the new user option ~kubed-logs-tail-lines~; +set it to 0 to fetch all available log lines. + +** Command ~kubed-logs~ is now bound to ~L~ in ~kubed-prefix-map~ + +* Version 0.5.1 on 2026-02-13 + +** Fix error with minibuffer completion for custom Kubernetes resources + +** ~kubed-use-context~ now also updates ~kubed-default-context-and-namespace~ + +Setting the default ~kubectl~ context with ~kubed-use-context~ now +also updates the user option ~kubed-default-context-and-namespace~, +such that Kubed commands will also use the new context as a default. + * Version 0.5.0 on 2025-06-11 ** DaemonSets support diff --git a/elpa/kubed-0.6.1/README-elpa b/elpa/kubed-0.6.1/README-elpa new file mode 100644 index 00000000..2dc11028 --- /dev/null +++ b/elpa/kubed-0.6.1/README-elpa @@ -0,0 +1,34 @@ +This library defines commands for interacting with Kubernetes +resources, such as Kubernetes pods, services, deployments, and more. + +Use `kubed-display-pod' to display a Kubernetes pod, +`kubed-edit-pod' to edit it, `kubed-delete-pods' to delete it, and +`kubed-list-pods' to see a menu of all pods. You can create new pods +from YAML or JSON files with `kubed-create-pod'. + +Similar commands are defined for other types of resources as well. + +This library interacts with Kubernetes via `kubectl', and uses the +current `kubectl' context and namespace by default. To change your +current context or namespace, use commands `kubed-use-context' and +`kubed-set-namespace' respectively; you can also interact with +resources in other namespaces without changing your default +namespace, for example you can call `kubed-list-pods' with a prefix +argument to choose another namespace for listing pods. The prefix +keymap `kubed-prefix-map' gives you quick access to these and other +useful commands, you may want to bind it globally to a convenient key +with `keymap-global-set': + + (keymap-global-set "C-c k" 'kubed-prefix-map) + +In addition, the command `kubed-transient' lets you explore various +Kubernetes operations with a transient menu interface. You may also +want to enable `kubed-menu-bar-mode', which add a "Kubernetes" menu +to your menu-bar with many useful entries. + +If you want to work with more or different types of Kubernetes +resources, use the macro `kubed-define-resource'. This macro defines +some common functions and commands that'll get you started with ease. + +For more information, see the Kubed manual at (info "(kubed)Top"), or +online at https://eshelyaron.com/kubed.html \ No newline at end of file diff --git a/elpa/kubed-0.5.0/assets/kubed-deployment-prefix-map.png b/elpa/kubed-0.6.1/assets/kubed-deployment-prefix-map.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-deployment-prefix-map.png rename to elpa/kubed-0.6.1/assets/kubed-deployment-prefix-map.png diff --git a/elpa/kubed-0.5.0/assets/kubed-list-transient.png b/elpa/kubed-0.6.1/assets/kubed-list-transient.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-list-transient.png rename to elpa/kubed-0.6.1/assets/kubed-list-transient.png diff --git a/elpa/kubed-0.5.0/assets/kubed-overview.png b/elpa/kubed-0.6.1/assets/kubed-overview.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-overview.png rename to elpa/kubed-0.6.1/assets/kubed-overview.png diff --git a/elpa/kubed-0.5.0/assets/kubed-prefix-map.png b/elpa/kubed-0.6.1/assets/kubed-prefix-map.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-prefix-map.png rename to elpa/kubed-0.6.1/assets/kubed-prefix-map.png diff --git a/elpa/kubed-0.5.0/assets/kubed-replace-diff.png b/elpa/kubed-0.6.1/assets/kubed-replace-diff.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-replace-diff.png rename to elpa/kubed-0.6.1/assets/kubed-replace-diff.png diff --git a/elpa/kubed-0.5.0/assets/kubed-scale-deployments.png b/elpa/kubed-0.6.1/assets/kubed-scale-deployments.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-scale-deployments.png rename to elpa/kubed-0.6.1/assets/kubed-scale-deployments.png diff --git a/elpa/kubed-0.5.0/assets/kubed-transient-exec.png b/elpa/kubed-0.6.1/assets/kubed-transient-exec.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-transient-exec.png rename to elpa/kubed-0.6.1/assets/kubed-transient-exec.png diff --git a/elpa/kubed-0.5.0/assets/kubed-transient.png b/elpa/kubed-0.6.1/assets/kubed-transient.png similarity index 100% rename from elpa/kubed-0.5.0/assets/kubed-transient.png rename to elpa/kubed-0.6.1/assets/kubed-transient.png diff --git a/elpa/kubed-0.5.0/cobra.el b/elpa/kubed-0.6.1/cobra.el similarity index 99% rename from elpa/kubed-0.5.0/cobra.el rename to elpa/kubed-0.6.1/cobra.el index c7d5ffb0..e9f63dfe 100644 --- a/elpa/kubed-0.5.0/cobra.el +++ b/elpa/kubed-0.6.1/cobra.el @@ -1,6 +1,6 @@ ;;; cobra.el --- Complete Cobra command lines -*- lexical-binding: t; -*- -;; Copyright (C) 2024-2025 Free Software Foundation, Inc. +;; Copyright (C) 2024-2026 Free Software Foundation, Inc. ;; Author: Eshel Yaron ;; Keywords: tools diff --git a/elpa/kubed-0.5.0/dir b/elpa/kubed-0.6.1/dir similarity index 100% rename from elpa/kubed-0.5.0/dir rename to elpa/kubed-0.6.1/dir diff --git a/elpa/kubed-0.5.0/kubed-autoloads.el b/elpa/kubed-0.6.1/kubed-autoloads.el similarity index 84% rename from elpa/kubed-0.5.0/kubed-autoloads.el rename to elpa/kubed-0.6.1/kubed-autoloads.el index e7274907..861ae2e8 100644 --- a/elpa/kubed-0.5.0/kubed-autoloads.el +++ b/elpa/kubed-0.6.1/kubed-autoloads.el @@ -11,8 +11,8 @@ ;;; Generated autoloads from cobra.el -(autoload 'cobra-read-command-line "cobra" "\ -Prompt with PROMPT for a command line starting with INITIAL. +(autoload 'cobra-read-command-line "cobra" +"Prompt with PROMPT for a command line starting with INITIAL. Optional argument HIST is the name of the history list variable to use, if it is nil or omitted, it defaults to `shell-command-history'. @@ -23,8 +23,8 @@ if it is nil or omitted, it defaults to `shell-command-history'. ;;; Generated autoloads from kubed.el -(autoload 'kubed-display-resource "kubed" "\ -Display Kubernetes RESOURCE of type TYPE in CONTEXT. +(autoload 'kubed-display-resource "kubed" +"Display Kubernetes RESOURCE of type TYPE in CONTEXT. For namespaced resource types, NAMESPACE is the namespace of RESOURCE. @@ -34,16 +34,16 @@ prompt for NAMESPACE. With a double prefix argument \\[universal-argument] \\[u prompt for CONTEXT as well. (fn TYPE RESOURCE CONTEXT &optional NAMESPACE)" t) -(autoload 'kubed-display-resource-handle-bookmark "kubed" "\ -Display Kubernetes resource according to BOOKMARK. +(autoload 'kubed-display-resource-handle-bookmark "kubed" +"Display Kubernetes resource according to BOOKMARK. (fn BOOKMARK)") -(autoload 'kubed-list-handle-bookmark "kubed" "\ -Display Kubernetes resource according to BOOKMARK. +(autoload 'kubed-list-handle-bookmark "kubed" +"Display Kubernetes resource according to BOOKMARK. (fn BOOKMARK)") -(autoload 'kubed-delete-resources "kubed" "\ -Delete Kubernetes RESOURCES of type TYPE in context CONTEXT. +(autoload 'kubed-delete-resources "kubed" +"Delete Kubernetes RESOURCES of type TYPE in context CONTEXT. For namespaced resource types, NAMESPACE is the namespace of RESOURCE. @@ -53,8 +53,8 @@ prompt for NAMESPACE. With a double prefix argument \\[universal-argument] \\[u prompt for CONTEXT as well. (fn TYPE RESOURCES CONTEXT &optional NAMESPACE)" t) -(autoload 'kubed-edit-resource "kubed" "\ -Edit Kubernetes RESOURCE of type TYPE in context CONTEXT. +(autoload 'kubed-edit-resource "kubed" +"Edit Kubernetes RESOURCE of type TYPE in context CONTEXT. For namespaced resource types, NAMESPACE is the namespace of RESOURCE. @@ -64,8 +64,8 @@ prompt for NAMESPACE. With a double prefix argument \\[universal-argument] \\[u prompt for CONTEXT as well. (fn TYPE RESOURCE CONTEXT &optional NAMESPACE)" t) -(autoload 'kubed-define-resource "kubed" "\ -Define Kubernetes RESOURCE with associated PROPERTIES and COMMANDS. +(autoload 'kubed-define-resource "kubed" +"Define Kubernetes RESOURCE with associated PROPERTIES and COMMANDS. RESOURCE is a symbol corresponding to a Kubernetes resource type, such as `pod' or `service'. This macro defines the following commands for @@ -152,7 +152,6 @@ Other keyword arguments that go between PROPERTIES and COMMANDS are: `kubed-list-transient'. (fn RESOURCE &optional PROPERTIES &rest COMMANDS)" nil t) -(function-put 'kubed-define-resource 'lisp-indent-function 2) (autoload 'kubed-display-pod "kubed" nil t) (autoload 'kubed-edit-pod "kubed" nil t) (autoload 'kubed-delete-pods "kubed" nil t) @@ -192,8 +191,8 @@ Other keyword arguments that go between PROPERTIES and COMMANDS are: (autoload 'kubed-create-job "kubed" nil t) (autoload 'kubed-logs-for-job "kubed" nil t) (autoload 'kubed-job-prefix-map "kubed" nil t 'keymap) -(autoload 'kubed-watch-deployment-status "kubed" "\ -Show and update status of Kubernetes deployment DEP in a dedicate buffer. +(autoload 'kubed-watch-deployment-status "kubed" +"Show and update status of Kubernetes deployment DEP in a dedicate buffer. Optional argument CONTEXT is the `kubectl' context to use, defaulting to the current context; NAMESPACE is the namespace of DEP, defaulting to @@ -204,8 +203,8 @@ Interactively, prompt for DEP. With a prefix argument, prompt for NAMESPACE too. With a double prefix argument, also prompt for CONTEXT. (fn DEP &optional CONTEXT NAMESPACE CB)" t) -(autoload 'kubed-scale-deployment "kubed" "\ -Scale deployment DEP in namespace NAMESPACE via CONTEXT to REPS replicas. +(autoload 'kubed-scale-deployment "kubed" +"Scale deployment DEP in namespace NAMESPACE via CONTEXT to REPS replicas. Optional argument CONTEXT is the `kubectl' context to use, defaulting to the current context; NAMESPACE is the namespace of DEP, defaulting to @@ -215,8 +214,8 @@ Interactively, prompt for DEP. With a prefix argument, prompt for NAMESPACE too. With a double prefix argument, also prompt for CONTEXT. (fn DEP REPS &optional CONTEXT NAMESPACE)" t) -(autoload 'kubed-restart-deployment "kubed" "\ -Restart Kubernetes deployment DEP in namespace NAMESPACE via CONTEXT. +(autoload 'kubed-restart-deployment "kubed" +"Restart Kubernetes deployment DEP in namespace NAMESPACE via CONTEXT. Optional argument CONTEXT is the `kubectl' context to use, defaulting to the current context; NAMESPACE is the namespace of DEP, defaulting to @@ -273,33 +272,42 @@ NAMESPACE too. With a double prefix argument, also prompt for CONTEXT. (autoload 'kubed-list-ingresss "kubed" nil t) (autoload 'kubed-create-ingress "kubed" nil t) (autoload 'kubed-ingress-prefix-map "kubed" nil t 'keymap) -(autoload 'kubed-use-context "kubed" "\ -Set current Kubernetes context to CONTEXT. +(autoload 'kubed-use-context "kubed" +"Set default `kubectl' context to CONTEXT. + +This command sets the global `kubectl' default context, and updates the +value of `kubed-default-context-and-namespace-alist' accordingly. + +Interactively, prompt for CONTEXT with completion. (fn CONTEXT)" t) -(autoload 'kubed-rename-context "kubed" "\ -Rename Kubernetes context OLD to NEW. +(autoload 'kubed-rename-context "kubed" +"Rename Kubernetes context OLD to NEW. (fn OLD NEW)" t) -(autoload 'kubed-display-config "kubed" "\ -Display current Kubernetes client settings in a YAML buffer." t) -(autoload 'kubed-set-namespace "kubed" "\ -Set default Kubernetes namespace in CONTEXT to NAMESPACE. +(autoload 'kubed-display-config "kubed" +"Display current Kubernetes client settings in a YAML buffer." t) +(autoload 'kubed-set-namespace "kubed" +"Set default Kubernetes namespace in CONTEXT to NAMESPACE. + +If CONTEXT is the current default context, also update the value of user +option `kubed-default-context-and-namespace-alist' to use NAMESPACE as +the default namespace. Interactively, prompt for NAMESPACE and use the current context. With a prefix argument, prompt for CONTEXT as well. (fn NAMESPACE &optional CONTEXT)" t) -(autoload 'kubed-apply "kubed" "\ -Apply CONFIG to Kubernetes resource of kind KIND via CONTEXT. +(autoload 'kubed-apply "kubed" +"Apply CONFIG to Kubernetes resource of kind KIND via CONTEXT. (fn CONFIG &optional KIND CONTEXT)" t) -(autoload 'kubed-create "kubed" "\ -Create resource of kind KIND with definition DEFINITION via CONTEXT. +(autoload 'kubed-create "kubed" +"Create resource of kind KIND with definition DEFINITION via CONTEXT. (fn DEFINITION &optional KIND CONTEXT)" t) -(autoload 'kubed-run "kubed" "\ -Run container IMAGE in a new Kubernetes POD. +(autoload 'kubed-run "kubed" +"Run container IMAGE in a new Kubernetes POD. Optional argument CONTEXT is the `kubectl' context to use, defaulting to the current context. NAMESPACE is the namespace in which to create POD, @@ -319,8 +327,8 @@ Interactively, prompt for POD and IMAGE. With a prefix argument, prompt for NAMESPACE; with a double prefix argument, also prompt for CONTEXT. (fn POD IMAGE &optional CONTEXT NAMESPACE PORT ATTACH STDIN TTY RM ENVS COMMAND ARGS)" t) -(autoload 'kubed-logs "kubed" "\ -Show logs for container CONTAINER in Kubernetes RESOURCE of type TYPE. +(autoload 'kubed-logs "kubed" +"Show logs for container CONTAINER in Kubernetes RESOURCE of type TYPE. Optional argument CONTEXT is the `kubectl' context to use; NAMESPACE is the namespace for RESOURCE; CONTAINER is the name of the container in @@ -330,12 +338,12 @@ With a prefix argument, prompt for NAMESPACE; with a double prefix argument, also prompt for CONTEXT. (fn TYPE RESOURCE &optional CONTEXT NAMESPACE CONTAINER FOLLOW LIMIT PREFIX SINCE TAIL TIMESTAMPS)" t) -(autoload 'kubed-forward-port-to-pod "kubed" "\ -Forward LOCAL-PORT to REMOTE-PORT of Kubernetes pod POD. +(autoload 'kubed-forward-port-to-pod "kubed" +"Forward LOCAL-PORT to REMOTE-PORT of Kubernetes pod POD. (fn POD LOCAL-PORT REMOTE-PORT CONTEXT NAMESPACE)" t) -(autoload 'kubed-attach "kubed" "\ -Attach to running process in CONTAINER in Kubernetes POD. +(autoload 'kubed-attach "kubed" +"Attach to running process in CONTAINER in Kubernetes POD. Optional argument NAMESPACE is the namespace in which to look for POD. Non-nil STDIN says to connect local standard input to remote process. @@ -347,8 +355,8 @@ NAMESPACE too. With a double prefix argument, also prompt for CONTEXT. STDIN and TTY are t interactively. (fn POD &optional CONTAINER CONTEXT NAMESPACE STDIN TTY)" t) -(autoload 'kubed-diff "kubed" "\ -Display difference between Kubernetes resource DEFINITION and current state. +(autoload 'kubed-diff "kubed" +"Display difference between Kubernetes resource DEFINITION and current state. DEFINITION is either a file name or a buffer. Interactively, prompt for a YAML or JSON file name to use as DEFINITION. @@ -358,8 +366,8 @@ the current context; non-nil INCLUDE-MANAGED (interactively, the prefix argument) says to include managed fields in the comparison. (fn DEFINITION &optional INCLUDE-MANAGED CONTEXT)" t) -(autoload 'kubed-exec "kubed" "\ -Execute COMMAND with ARGS in CONTAINER in Kubernetes POD. +(autoload 'kubed-exec "kubed" +"Execute COMMAND with ARGS in CONTAINER in Kubernetes POD. Optional argument NAMESPACE is the namespace in which to look for POD. Non-nil STDIN says to connect local standard input to remote process. @@ -371,8 +379,8 @@ NAMESPACE too. With a double prefix argument, also prompt for CONTEXT. STDIN and TTY are t interactively. (fn POD COMMAND &optional CONTAINER CONTEXT NAMESPACE STDIN TTY ARGS)" t) -(autoload 'kubed-patch "kubed" "\ -Patch Kubernetes resource NAME of TYPE with patch PATCH. +(autoload 'kubed-patch "kubed" +"Patch Kubernetes resource NAME of TYPE with patch PATCH. Optional argument NAMESPACE is the namespace in which to look for NAME. STRATEGY is the patch type to use, one of \"json\", \"merge\" and @@ -383,8 +391,8 @@ prompt for NAMESPACE too. With a double prefix argument, also prompt for CONTEXT. (fn TYPE NAME PATCH &optional CONTEXT NAMESPACE STRATEGY)" t) -(autoload 'kubed-proxy "kubed" "\ -Start a web server on localhost proxying the Kubernetes API server. +(autoload 'kubed-proxy "kubed" +"Start a web server on localhost proxying the Kubernetes API server. ADDR and PORT are the local address and port to bind the proxy server to. They default to 127.0.0.1 and 8001, respectively. API-PREFIX is a @@ -394,16 +402,16 @@ Lastly, CONTEXT is the the `kubectl' context to use, defaulting to the local context. (fn &optional ADDR PORT API-PREFIX WWW-DIR WWW-PREFIX CONTEXT)" t) -(autoload 'kubed-stop-proxy "kubed" "\ -Stop local proxy for context CONTEXT, defaulting to the local context. +(autoload 'kubed-stop-proxy "kubed" +"Stop local proxy for context CONTEXT, defaulting to the local context. (fn &optional CONTEXT)" t) -(autoload 'kubed-explain "kubed" "\ -Show help buffer with explanation about Kubernetes resource FIELD. +(autoload 'kubed-explain "kubed" +"Show help buffer with explanation about Kubernetes resource FIELD. (fn FIELD)" t) -(autoload 'kubed-kubectl-command "kubed" "\ -Execute `kubectl' COMMAND. +(autoload 'kubed-kubectl-command "kubed" +"Execute `kubectl' COMMAND. This function calls `shell-command' (which see) to do the work. @@ -411,16 +419,16 @@ Interactively, prompt for COMMAND with completion for `kubectl' arguments. (fn COMMAND)" t) (autoload 'kubed-prefix-map "kubed" nil t 'keymap) -(defvar kubed-menu-bar-mode nil "\ -Non-nil if Kubed-Menu-Bar mode is enabled. +(defvar kubed-menu-bar-mode nil +"Non-nil if Kubed-Menu-Bar mode is enabled. See the `kubed-menu-bar-mode' command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `kubed-menu-bar-mode'.") (custom-autoload 'kubed-menu-bar-mode "kubed" nil) -(autoload 'kubed-menu-bar-mode "kubed" "\ -Add \"Kubernetes\" menu to your menu bar. +(autoload 'kubed-menu-bar-mode "kubed" +"Add \"Kubernetes\" menu to your menu bar. This is a global minor mode. If called interactively, toggle the `Kubed-Menu-Bar mode' mode. If the prefix argument is positive, enable @@ -447,20 +455,20 @@ disabled. ;;; Generated autoloads from kubed-tramp.el -(autoload 'kubed-tramp-context "kubed-tramp" "\ -Extract `kubectl' context from Kubed Tramp remote file name FILE-NAME. +(autoload 'kubed-tramp-context "kubed-tramp" +"Extract `kubectl' context from Kubed Tramp remote file name FILE-NAME. (fn FILE-NAME)") -(autoload 'kubed-tramp-namespace "kubed-tramp" "\ -Extract Kubernetes namespace from Kubed Tramp remote file name FILE-NAME. +(autoload 'kubed-tramp-namespace "kubed-tramp" +"Extract Kubernetes namespace from Kubed Tramp remote file name FILE-NAME. (fn FILE-NAME)") -(autoload 'kubed-tramp-assert-support "kubed-tramp" "\ -Check if Kubed Tramp support is available, throw `user-error' if not.") -(autoload 'kubed-tramp-enable "kubed-tramp" "\ -Enable Kubed integration with Tramp.") +(autoload 'kubed-tramp-assert-support "kubed-tramp" +"Check if Kubed Tramp support is available, throw `user-error' if not.") +(autoload 'kubed-tramp-enable "kubed-tramp" +"Enable Kubed integration with Tramp.") (with-eval-after-load 'tramp (kubed-tramp-enable)) -(register-definition-prefixes "kubed-tramp" '("kubed-tramp--")) +(register-definition-prefixes "kubed-tramp" '("kubed-tramp-")) ;;; Generated autoloads from kubed-transient.el diff --git a/elpa/kubed-0.5.0/kubed-common.el b/elpa/kubed-0.6.1/kubed-common.el similarity index 91% rename from elpa/kubed-0.5.0/kubed-common.el rename to elpa/kubed-0.6.1/kubed-common.el index f7cb240e..e5199bf0 100644 --- a/elpa/kubed-0.5.0/kubed-common.el +++ b/elpa/kubed-0.6.1/kubed-common.el @@ -1,6 +1,6 @@ ;;; kubed-common.el --- Common definitons for Kubed -*- lexical-binding: t; -*- -;; Copyright (C) 2024-2025 Free Software Foundation, Inc. +;; Copyright (C) 2024-2026 Free Software Foundation, Inc. ;; Author: Eshel Yaron ;; Keywords: tools diff --git a/elpa/kubed-0.5.0/kubed-pkg.el b/elpa/kubed-0.6.1/kubed-pkg.el similarity index 60% rename from elpa/kubed-0.5.0/kubed-pkg.el rename to elpa/kubed-0.6.1/kubed-pkg.el index 9717f71b..2a2f2d47 100644 --- a/elpa/kubed-0.5.0/kubed-pkg.el +++ b/elpa/kubed-0.6.1/kubed-pkg.el @@ -1,2 +1,2 @@ -;; Generated package description from kubed.el -*- mode: lisp-data; no-byte-compile: t -*- -(define-package "kubed" "0.5.0" "Kubernetes, Emacs, done!" '((emacs "29.1")) :commit "e8a6f9b0dc25d44f3783036962d6c08eacbdbd23" :authors '(("Eshel Yaron" . "me@eshelyaron.com")) :maintainer '("Eshel Yaron" . "~eshel/kubed-devel@lists.sr.ht") :keywords '("tools" "kubernetes" "containers") :url "https://eshelyaron.com/kubed.html") +;; Generated package description from kubed.el -*- mode: lisp-data; no-byte-compile: t; lexical-binding:t -*- +(define-package "kubed" "0.6.1" "Kubernetes, Emacs, done!" '((emacs "29.1")) :commit "2f231466790c5db18a6e1479e3c67945d43cbf94" :authors '(("Eshel Yaron" . "me@eshelyaron.com")) :maintainer '("Eshel Yaron" . "~eshel/kubed-devel@lists.sr.ht") :keywords '("tools" "kubernetes" "containers") :url "https://eshelyaron.com/kubed.html") diff --git a/elpa/kubed-0.5.0/kubed-tramp.el b/elpa/kubed-0.6.1/kubed-tramp.el similarity index 56% rename from elpa/kubed-0.5.0/kubed-tramp.el rename to elpa/kubed-0.6.1/kubed-tramp.el index 9e6fbac4..12d0f83d 100644 --- a/elpa/kubed-0.5.0/kubed-tramp.el +++ b/elpa/kubed-0.6.1/kubed-tramp.el @@ -1,6 +1,6 @@ ;;; kubed-tramp.el --- Kubed Tramp integration -*- lexical-binding: t; -*- -;; Copyright (C) 2024-2025 Free Software Foundation, Inc. +;; Copyright (C) 2024-2026 Free Software Foundation, Inc. ;; Author: Eshel Yaron ;; Keywords: tools @@ -95,12 +95,67 @@ (unless (assoc kubed-tramp-method tramp-methods) (user-error "Kubed Tramp support requires Tramp version 2.7 or later"))) +(defun kubed-tramp--previous-hop (vec) + (or + ;; Previous hop explicit in VEC. + (when-let ((hop (tramp-file-name-hop vec))) + (tramp-make-tramp-file-name + (tramp-dissect-hop-name (tramp-file-name-hop vec)))) + ;; Implicit previous hop registered in `tramp-default-proxies-alist'. + (seq-some + (lambda (item) + ;; Here we replicate what `tramp-compute-multi-hops' does... + (when (and + ;; Host. + (string-match-p + (or (eval (nth 0 item) t) "") + (or (tramp-file-name-host-port vec) "")) + ;; User. + (string-match-p + (or (eval (nth 1 item) t) "") + (or (tramp-file-name-user-domain vec) ""))) + (tramp-format-spec + (eval (nth 2 item) t) + (format-spec-make + ?u (or (tramp-file-name-user vec) "") + ?h (or (tramp-file-name-host vec) ""))))) + tramp-default-proxies-alist))) + +(defun kubed-tramp--login-program (vec) + "Return `kubectl' program to use for connection VEC. + +Respect the connection-local value of user option `kubed-kubectl-program'." + (if-let ((hop-dir (kubed-tramp--previous-hop vec))) + (let ((default-directory hop-dir)) + (connection-local-value kubed-kubectl-program 'kubed)) + kubed-kubectl-program)) + +(defun kubed-tramp-get-method-parameter-advice (of vec param &rest rest) + (if (and (eq param 'tramp-login-program) + (member (tramp-file-name-method vec) + `(,kubed-tramp-method + ;; Old versions: + "kubedv1"))) + ;; When Tramp asks how to invoke kubectl on our behalf, + ;; point it to the up-to-date (and possibly connection-local) + ;; value of `kubed-kubectl-program'. + (kubed-tramp--login-program vec) + (apply of vec param rest))) + ;;;###autoload (defun kubed-tramp-enable () "Enable Kubed integration with Tramp." (when (boundp 'tramp-extra-expand-args) ; Tramp 2.7+ - (let ((params `((tramp-login-program ,kubed-kubectl-program) + (let ((params `(;; Note that this "hardcodes" the current value of + ;; `kubed-kubectl-program', which is the common + ;; practice with Tramp methods, but it is not what + ;; we want. But that's ok: the value we put here is + ;; not actually used, because we install an advice + ;; that gives the up-to-date (and possibly + ;; connection-local, for remote hosts) value of + ;; `kubed-kubectl-program' when Tramp asks. + (tramp-login-program "%b") (tramp-login-args (("exec") ("--context" "%x") ("--namespace" "%y") @@ -120,10 +175,11 @@ (connection-local-set-profile-variables 'kubed-tramp-connection-local-default-profile '((tramp-extra-expand-args - ?a (kubed-tramp--container (car tramp-current-connection)) - ?h (kubed-tramp--pod (car tramp-current-connection)) - ?x (kubed-tramp--context (car tramp-current-connection)) - ?y (kubed-tramp--namespace (car tramp-current-connection))))) + ?b (kubed-tramp--login-program (car tramp-current-connection)) + ?a (kubed-tramp--container (car tramp-current-connection)) + ?h (kubed-tramp--pod (car tramp-current-connection)) + ?x (kubed-tramp--context (car tramp-current-connection)) + ?y (kubed-tramp--namespace (car tramp-current-connection))))) (connection-local-set-profiles '(:application tramp :protocol "kubedv1") @@ -135,14 +191,30 @@ (connection-local-set-profile-variables 'kubed-tramp-v2-connection-local-default-profile '((tramp-extra-expand-args - ?a (kubed-tramp--container (car tramp-current-connection)) - ?h (kubed-tramp--pod (car tramp-current-connection)) - ?x (kubed-tramp--v2-context (car tramp-current-connection)) - ?y (kubed-tramp--namespace (car tramp-current-connection))))) + ?b (kubed-tramp--login-program (car tramp-current-connection)) + ?a (kubed-tramp--container (car tramp-current-connection)) + ?h (kubed-tramp--pod (car tramp-current-connection)) + ?x (kubed-tramp--v2-context (car tramp-current-connection)) + ?y (kubed-tramp--namespace (car tramp-current-connection))))) (connection-local-set-profiles `(:application tramp :protocol ,kubed-tramp-method) - 'kubed-tramp-v2-connection-local-default-profile)))) + 'kubed-tramp-v2-connection-local-default-profile)) + + (when (or (version< tramp-version "2.8.1.4") + (not (fboundp 'tramp-suppress-remote-file-name-inhibit-cache))) + ;; Arg expansion for `tramp-login-program' was added in 2.8.1.4; + ;; for earlier versions we advise `tramp-get-method-parameter' to + ;; get the right value. + ;; (See https://lists.gnu.org/r/tramp-devel/2026-03/msg00000.html) + ;; The check for `tramp-suppress-remote-file-name-inhibit-cache' + ;; is for the benefit of users of the development version of Emacs + ;; (31.0.50, which has `tramp-version' 2.8.2-pre) prior to the + ;; addition of the new arg expansion, since this function happened + ;; to be added shortly after. + (advice-add 'tramp-get-method-parameter :around + #'kubed-tramp-get-method-parameter-advice + '((name . kubed)))))) ;;;###autoload (with-eval-after-load 'tramp (kubed-tramp-enable)) diff --git a/elpa/kubed-0.5.0/kubed-transient.el b/elpa/kubed-0.6.1/kubed-transient.el similarity index 90% rename from elpa/kubed-0.5.0/kubed-transient.el rename to elpa/kubed-0.6.1/kubed-transient.el index faf861ca..d03a2b93 100644 --- a/elpa/kubed-0.5.0/kubed-transient.el +++ b/elpa/kubed-0.6.1/kubed-transient.el @@ -1,6 +1,6 @@ ;;; kubed-transient.el --- Kubernetes transient menus -*- lexical-binding: t; -*- -;; Copyright (C) 2024-2025 Free Software Foundation, Inc. +;; Copyright (C) 2024-2026 Free Software Foundation, Inc. ;; Author: Eshel Yaron ;; Keywords: tools @@ -79,6 +79,7 @@ Return an RFC3339 string representation of the selected date." Optional argument PLURAL is the plural form of RESOURCE. If nil, it defaults to \"RESOURCEs\"." + (setq plural (or plural (concat resource "s"))) (let ((name (intern (concat "kubed-transient-logs-for-" resource)))) `(transient-define-prefix ,name (&optional value) ,(format "Show logs for a Kubernetes %s." resource) @@ -87,6 +88,7 @@ defaults to \"RESOURCEs\"." ("l" "Show Logs" ,(intern (concat "kubed-logs-for-" resource))) ("!" "Command line" kubed-kubectl-command)] ["Options" + :pad-keys t ("-n" "Namespace" "--namespace=" :prompt "Namespace" :reader kubed-transient-read-namespace) ("-C" "Context" "--context=" @@ -96,19 +98,45 @@ defaults to \"RESOURCEs\"." ("-t" "Limit lines" "--tail=" :prompt "Lines limit: " :reader transient-read-number-N+) ("-S" "Since time" "--since-time=" - :prompt "Since time: " :reader kubed-transient-read-date)] + :prompt "Since time: " :reader kubed-transient-read-date) + ("/" ,(format "%s" (capitalize resource)) ,(concat plural "/") + :class transient-option + :always-read t + :prompt "Show logs for" + :reader (lambda (prompt _initial-input _history) + (let* ((context (seq-some (lambda (s) + (and (cl-typep s 'transient-infix) + (equal (oref s argument) "--context=") + (oref s value))) + transient--suffixes)) + (namespace (seq-some (lambda (s) + (and (cl-typep s 'transient-infix) + (equal (oref s argument) "--namespace=") + (oref s value))) + transient--suffixes)) + (default (seq-some (lambda (s) + (and (cl-typep s 'transient-infix) + (equal (oref s argument) ,(concat plural "/")) + (oref s value))) + transient--suffixes))) + (,(intern (format "kubed-read-%s" resource)) + prompt default nil context namespace))))] ["Switches" ("-A" "All containers" "--all-containers") ("-f" "Stream logs" "--follow") ("-P" "Add pod and container" "--prefix") ("-T" "Add timestamps" "--timestamps")]] (interactive - (list (kubed-transient-args 'kubed-transient-logs))) + (list (append + (kubed-transient-args) + (when-let ((res (tabulated-list-get-id))) + (list (concat ,(concat plural "/") res))) + (unless (zerop kubed-logs-tail-lines) + (list (format "--tail=%d" kubed-logs-tail-lines))) + (when kubed-logs-follow (list "--follow"))))) (transient-setup ',name nil nil :value value - :scope '("logs" ,(concat (or plural - (concat resource "s")) - "/")))))) + :scope '("logs"))))) ;;;###autoload (autoload 'kubed-transient-logs-for-pod "kubed-transient" nil t) (kubed-transient-logs-for-resource "pod") @@ -132,7 +160,7 @@ defaults to \"RESOURCEs\"." (kubed-transient-logs-for-resource "statefulset") ;;;###autoload (autoload 'kubed-transient-logs "kubed-transient" nil t) -(transient-define-prefix kubed-transient-logs () +(transient-define-prefix kubed-transient-logs (&optional value) "Show logs for containers running in Kubernetes." ["Kubernetes Logs\n" ["Kinds" @@ -158,8 +186,14 @@ defaults to \"RESOURCEs\"." ("-f" "Stream logs" "--follow") ("-P" "Add pod and container" "--prefix") ("-T" "Add timestamps" "--timestamps")]] - (interactive) + (interactive + (list (append + (kubed-transient-args) + (unless (zerop kubed-logs-tail-lines) + (list (format "--tail=%d" kubed-logs-tail-lines))) + (when kubed-logs-follow (list "--follow"))))) (transient-setup 'kubed-transient-logs nil nil + :value value :scope '("logs"))) ;;;###autoload (autoload 'kubed-transient-scale-deployment "kubed-transient" nil t) diff --git a/elpa/kubed-0.5.0/kubed.el b/elpa/kubed-0.6.1/kubed.el similarity index 90% rename from elpa/kubed-0.5.0/kubed.el rename to elpa/kubed-0.6.1/kubed.el index f28a5e3d..4c276fd0 100644 --- a/elpa/kubed-0.5.0/kubed.el +++ b/elpa/kubed-0.6.1/kubed.el @@ -1,12 +1,12 @@ ;;; kubed.el --- Kubernetes, Emacs, done! -*- lexical-binding: t; -*- -;; Copyright (C) 2024-2025 Free Software Foundation, Inc. +;; Copyright (C) 2024-2026 Free Software Foundation, Inc. ;; Author: Eshel Yaron ;; Maintainer: Eshel Yaron <~eshel/kubed-devel@lists.sr.ht> ;; Keywords: tools kubernetes containers ;; URL: https://eshelyaron.com/kubed.html -;; Package-Version: 0.5.0 +;; Package-Version: 0.6.1 ;; Package-Requires: ((emacs "29.1")) ;;; Commentary: @@ -54,15 +54,30 @@ "Kubernetes interface." :group 'tools) -(defcustom kubed-default-context-and-namespace nil - "Default `kubectl' context and Kubernetes namespace. - -This is either a cons cell (CONTEXT . NAMESPACE), or nil. If nil, Kubed -initializes this option to a non-nil value next time Kubed consults it." - :type '(choice (const :tag "Initialize from `kubectl' on first use" nil) - (cons :tag "Context and namespace" - (string :tag "Context") - (string :tag "Namespace")))) +(defvar kubed-default-context-and-namespace nil) +(make-obsolete-variable + 'kubed-default-context-and-namespace + 'kubed-default-context-and-namespace-alist + "Kubed 0.6.0") + +(defcustom kubed-default-context-and-namespace-alist + `((nil . ,kubed-default-context-and-namespace)) + "Alist mapping hosts to their default `kubectl' context and Kubernetes namespace. + +Each alist entry is (HOST . CONTEXT-AND-NAMESPACE), where HOST is either +a remote host identifier (as returned by `file-remote-p') or nil which +represents the local host, and CONTEXT-AND-NAMESPACE is either a cons +cell (CONTEXT . NAMESPACE), or nil. If it is nil, Kubed initializes +CONTEXT-AND-NAMESPACE to a non-nil value next time Kubed consults it." + :type '(alist + :key-type + (choice (const :tag "Local host" nil) + (string :tag "Remote host")) + :value-type + (choice (const :tag "Initialize from `kubectl' on first use" nil) + (cons :tag "Context and namespace" + (string :tag "Context") + (string :tag "Namespace"))))) (defcustom kubed-yaml-setup-hook '(yaml-ts-mode view-mode) "List of functions to call in Kubernetes resource description YAML buffers. @@ -75,47 +90,65 @@ by default it is `yaml-ts-mode'." "List of functions to call when setting up Kubernetes pod logs buffers." :type 'hook) +(defcustom kubed-logs-tail-lines 128 + "Number of most recent log lines to fetch and show in Kubernetes logs buffers. + +The value 0 says to fetch and show all available log lines without limit." + :type '(natnum :tag "Number of lines (0 for all)")) + +(defcustom kubed-logs-follow t + "Whether to \"follow\" new logs in Kubernetes logs buffers." + :type 'boolean) + (defcustom kubed-name-column '("Name" 48 t) "Specification of resource name column in Kubernetes resource list buffers." :type '(list string natnum boolean)) +(defsubst kubed-kubectl-program () + "Return the connection-local value of variable `kubed-kubectl-program'." + (connection-local-value kubed-kubectl-program 'kubed)) + (defvar kubed--data nil) -(defun kubed--alist (type context namespace) - "Return information about resources in CONTEXT of type TYPE in NAMESPACE." +(defun kubed--alist (host type context namespace) + "Return information about resources of type TYPE for HOST, CONTEXT and NAMESPACE." (alist-get namespace (alist-get type (alist-get context - kubed--data nil nil #'string=) + (alist-get host kubed--data nil nil #'equal) + nil nil #'string=) nil nil #'string=) nil nil #'equal)) -(gv-define-setter kubed--alist (value type context namespace) +(gv-define-setter kubed--alist (value host type context namespace) `(setf (alist-get ,namespace (alist-get ,type (alist-get ,context - kubed--data nil nil #'string=) + (alist-get ,host kubed--data nil nil #'equal) + nil nil #'string=) nil nil #'string=) nil nil #'equal) ,value)) (defvar kubed--columns nil) -(defun kubed-update (type context &optional namespace) +(defun kubed-update (type context &optional namespace host) "Update list of resources of type TYPE in CONTEXT and NAMESPACE." - (when (process-live-p (alist-get 'process (kubed--alist type context namespace))) + (unless host (setq host (file-remote-p default-directory))) + (when (process-live-p (alist-get 'process (kubed--alist host type context namespace))) (user-error "Update in progress")) (let* ((out (get-buffer-create (format " *kubed-get-%s*" type))) (err (get-buffer-create (format " *kubed-get-%s-stderr*" type))) - (columns (alist-get type kubed--columns nil nil #'string=))) + (columns (alist-get type kubed--columns '(("NAME:.metadata.name")) nil #'string=))) (with-current-buffer out (erase-buffer)) - (setf (alist-get 'process (kubed--alist type context namespace)) + (setf (alist-get 'process (kubed--alist host type context namespace)) (make-process :name (format "*kubed-get-%s*" type) :buffer out :stderr err + :file-handler t :command (append - (list kubed-kubectl-program "get" type + (list (kubed-kubectl-program) "get" type "--context" context (format "--output=custom-columns=%s" (mapconcat #'car columns ","))) @@ -146,7 +179,7 @@ by default it is `yaml-ts-mode'." (setq beg (pop ends)))) (push (nreverse cols) new)) (forward-line 1))) - (setf (kubed--alist type context namespace) + (setf (kubed--alist host type context namespace) (list (cons 'resources (mapcar (lambda (c) (list (car c) (apply #'vector c))) new)))) @@ -155,6 +188,9 @@ by default it is `yaml-ts-mode'." (and (equal (buffer-local-value 'kubed-list-type buf) type) (equal (buffer-local-value 'kubed-list-context buf) context) (equal (buffer-local-value 'kubed-list-namespace buf) namespace) + (equal (file-remote-p + (buffer-local-value 'default-directory buf)) + host) (with-current-buffer buf (when (derived-mode-p 'kubed-list-mode) (revert-buffer) @@ -194,8 +230,8 @@ the namespace of the resource, or nil if TYPE is not namespaced.") (with-temp-buffer (unless (zerop (apply - #'call-process - kubed-kubectl-program nil t nil "get" + #'process-file + (kubed-kubectl-program) nil t nil "get" type "--output=yaml" name (append (when namespace (list "-n" namespace)) (when context (list "--context" context))))) @@ -209,8 +245,10 @@ the namespace of the resource, or nil if TYPE is not namespaced.") (defun kubed-display-resource-in-buffer (buffer type resource &optional context namespace) "Display Kubernetes RESOURCE of type TYPE in BUFFER." - (let ((info (list type resource context namespace))) + (let ((info (list type resource context namespace)) + (dir default-directory)) (with-current-buffer (get-buffer-create buffer) + (setq-local default-directory dir) (setq-local kubed-display-resource-info info) (kubed-display-resource-revert) (goto-char (point-min)) @@ -350,10 +388,16 @@ prompt for CONTEXT as well." (when (= ?y choice) (let ((err-buf (get-buffer-create " *kubed-replace*"))) (with-current-buffer err-buf (erase-buffer)) - (unless (zerop (call-process-region nil nil kubed-kubectl-program - nil err-buf nil "replace" "-f" "-")) - (display-buffer err-buf) - (user-error "`kubectl replace' failed!"))) + (let ((tmpfile (make-temp-file "kubed"))) + (unwind-protect + (progn + (write-region (point-min) (point-max) tmpfile) + (unless (zerop (process-file (kubed-kubectl-program) + tmpfile err-buf nil + "replace" "-f" "-")) + (display-buffer err-buf) + (user-error "`kubectl replace' failed!"))) + (delete-file tmpfile)))) (message "Replaced Kubernetes resource with changes in current buffer.") (revert-buffer)))) @@ -503,20 +547,21 @@ If FILTER is omitted or nil, it defaults to `kubed-list-filter'." (defvar-local kubed-list-transient-extra-suffixes nil "List of transient suffixes for the type of resources in current buffer.") +(defsubst kubed--event-point (event) + "Return buffer position of EVENT." + (posn-point (event-start event))) + (defun kubed-list-go-to-line (id) "Go to beginning of table line with ID." - (let ((pos nil)) + (let ((proc (alist-get 'process + (kubed--alist (file-remote-p default-directory) + kubed-list-type + kubed-list-context + kubed-list-namespace))) + (pos nil)) (save-excursion ;; Wait for refresh to finish, if currently underway. - (while (process-live-p - (alist-get 'process (kubed--alist kubed-list-type - kubed-list-context - kubed-list-namespace))) - (accept-process-output - (alist-get 'process (kubed--alist kubed-list-type - kubed-list-context - kubed-list-namespace)) - 1)) + (while (process-live-p proc) (accept-process-output proc 1)) (goto-char (point-min)) (while (not (or pos (eobp))) (if (equal id (tabulated-list-get-id)) @@ -539,7 +584,7 @@ of the error, push a mark before moving point." (progn ;; FIXME: There is a small edge case here that could get ;; better treatment: when `contents' ends with " ?", it - ;; espaces the terminating closing parenthesis and leads us + ;; escapes the terminating closing parenthesis and leads us ;; to incorrectly report the input as incomplete. (insert "(" contents ")") (goto-char (point-min)) @@ -568,7 +613,8 @@ of the error, push a mark before moving point." (cols (seq-map #'car tabulated-list-format)) (vals (let ((tmp nil)) (dolist (ent (alist-get 'resources - (kubed--alist kubed-list-type + (kubed--alist (file-remote-p default-directory) + kubed-list-type kubed-list-context kubed-list-namespace))) (let ((i 0)) @@ -705,7 +751,7 @@ to 1." (defun kubed-list-copy-as-kill (click) "Copy name of Kubernetes resource at CLICK into the kill ring." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((ent (tabulated-list-get-entry (mouse-set-point click))) + (if-let ((ent (tabulated-list-get-entry (kubed--event-point click))) (new (aref ent 0))) (progn (kill-new new) @@ -714,7 +760,7 @@ to 1." (defun kubed-list-context-menu (menu click) "Extend MENU with common actions on Kubernetes resource at CLICK." - (when (tabulated-list-get-entry (posn-point (event-start click))) + (when (tabulated-list-get-entry (kubed--event-point click)) (define-key menu [kubed-list-select-resource] '(menu-item "Select" kubed-list-select-resource)) (define-key menu [kubed-list-display-resource] @@ -767,7 +813,8 @@ regardless of QUIET." (make-process :name "*kubed-list-delete-marked*" :stderr errb - :command (cons kubed-kubectl-program + :file-handler t + :command (cons (kubed-kubectl-program) (append (when kubed-list-context (list "--context" kubed-list-context)) @@ -793,7 +840,7 @@ regardless of QUIET." (defun kubed-list-display-resource (click) "Display Kubernetes resource at CLICK in another window." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) (kubed-display-resource kubed-list-type resource kubed-list-context kubed-list-namespace) (user-error "No Kubernetes resource at point"))) @@ -801,7 +848,7 @@ regardless of QUIET." (defun kubed-list-select-resource (click) "Display Kubernetes resource at CLICK in current window." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) (switch-to-buffer (kubed-display-resource-in-buffer (concat "*Kubed " @@ -814,7 +861,7 @@ regardless of QUIET." (defun kubed-list-select-resource-other-window (click) "Display Kubernetes resource at CLICK in other window and select that window." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) (switch-to-buffer-other-window (kubed-display-resource-in-buffer (concat "*Kubed " @@ -827,7 +874,7 @@ regardless of QUIET." (defun kubed-list-delete (click) "Delete Kubernetes resource at CLICK." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) (when (y-or-n-p (format "Delete `%s'?" resource)) (kubed-delete-resources kubed-list-type (list resource) kubed-list-context kubed-list-namespace)) @@ -836,7 +883,7 @@ regardless of QUIET." (defun kubed-list-patch (click) "Patch Kubernetes resource at CLICK." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) (kubed-patch kubed-list-type resource (kubed-read-patch) kubed-list-context kubed-list-namespace) (user-error "No Kubernetes resource at point"))) @@ -844,7 +891,7 @@ regardless of QUIET." (defun kubed-list-edit (click) "Edit Kubernetes resource at CLICK." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) (kubed-edit-resource kubed-list-type resource kubed-list-context kubed-list-namespace) (user-error "No Kubernetes resource at point"))) @@ -852,7 +899,7 @@ regardless of QUIET." (defun kubed-list-kubectl-command (click) "Use Kubernetes resource at CLICK as argument for `kubectl' command." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) (kubed-kubectl-command (kubed-read-kubectl-command "Execute command: " @@ -868,9 +915,10 @@ regardless of QUIET." (defun kubed-list-logs (click) "Show logs for Kubernetes resource at CLICK." (interactive (list last-nonmenu-event) kubed-list-mode) - (if-let ((resource (tabulated-list-get-id (mouse-set-point click)))) - (kubed-logs kubed-list-type resource kubed-list-context kubed-list-namespace - t t nil t) + (if-let ((resource (tabulated-list-get-id (kubed--event-point click)))) + (let ((lines (unless (zerop kubed-logs-tail-lines) kubed-logs-tail-lines))) + (kubed-logs kubed-list-type resource kubed-list-context kubed-list-namespace + t kubed-logs-follow nil t nil lines)) (user-error "No Kubernetes resource at point"))) (defun kubed-list-create (definition &optional kind) @@ -938,6 +986,7 @@ number at point, or the numeric prefix argument if you provide one." (tabulated-list-print t) (tabulated-list-init-header)) +(declare-function kubed-transient "kubed-transient" ()) (declare-function kubed-list-transient "kubed-transient" ()) (declare-function kubed-transient-logs-for-pod "kubed-transient" (val)) (declare-function kubed-transient-logs-for-deployment "kubed-transient" (val)) @@ -975,7 +1024,8 @@ number at point, or the numeric prefix argument if you provide one." "`tabulated-list-entries' function for `kubed-list-mode'." (let ((pred (kubed-list-interpret-filter)) (ents nil)) - (dolist (ent (alist-get 'resources (kubed--alist kubed-list-type + (dolist (ent (alist-get 'resources (kubed--alist (file-remote-p default-directory) + kubed-list-type kubed-list-context kubed-list-namespace))) (when (funcall pred ent) (push ent ents))) @@ -1086,8 +1136,8 @@ prompt for CONTEXT as well." (unless resources (user-error "You didn't specify %s to delete" type)) (message (format "Deleting Kubernetes %s `%s'..." type (string-join resources "', `"))) - (if (zerop (apply #'call-process - kubed-kubectl-program nil nil nil + (if (zerop (apply #'process-file + (kubed-kubectl-program) nil nil nil "delete" type (append (when namespace (list "-n" namespace)) (when context (list "--context" context)) @@ -1137,9 +1187,9 @@ prompt for CONTEXT as well." (concat "KUBE_EDITOR=" emacsclient-program-name) "KUBE_EDITOR=emacsclient") process-environment))) - (apply #'start-process + (apply #'start-file-process (format "*kubed-%S-edit*" type) nil - kubed-kubectl-program "edit" type resource + (kubed-kubectl-program) "edit" type resource (append (when namespace (list "-n" namespace)) (when context (list "--context" context)))))) @@ -1148,7 +1198,8 @@ prompt for CONTEXT as well." '(:eval (cond ((process-live-p (alist-get 'process - (kubed--alist kubed-list-type + (kubed--alist (file-remote-p default-directory) + kubed-list-type kubed-list-context kubed-list-namespace))) (propertize "[...]" 'help-echo "Updating...")) @@ -1491,6 +1542,8 @@ a prefix argument \\[universal-argument], prompt for CONTEXT too." (dolist (arg (kubed-transient-args ',logs-trs)) (cond + ((string-match ,(format "%S/\\(.+\\)" plrl-var) arg) + (setq ,resource (match-string 1 arg))) ((string-match "--namespace=\\(.+\\)" arg) (setq namespace (match-string 1 arg))) ((string-match "--context=\\(.+\\)" arg) @@ -1513,19 +1566,28 @@ a prefix argument \\[universal-argument], prompt for CONTEXT too." cxt)))) (unless namespace (setq namespace (kubed--namespace context current-prefix-arg))) - (setq ,resource (,read-fun "Show logs for" - (and (equal context kubed-list-context) - (equal namespace kubed-list-namespace) - (equal ,(symbol-name plrl-var) kubed-list-type) - (tabulated-list-get-id (mouse-set-point last-nonmenu-event))) - nil context namespace)) + (unless ,resource + (setq ,resource (,read-fun "Show logs for" + (and (equal context kubed-list-context) + (equal namespace kubed-list-namespace) + (equal ,(symbol-name plrl-var) kubed-list-type) + (tabulated-list-get-id (kubed--event-point last-nonmenu-event))) + nil context namespace))) (list ,resource context namespace ,(if (eq resource 'pod) '(or container (kubed-read-container pod "Container" t context namespace)) 'container) - follow limit prefix since tail timestamps))) + (or follow + (unless (bound-and-true-p transient-current-command) + kubed-logs-follow)) + limit prefix since + (or tail + (unless (or (bound-and-true-p transient-current-command) + (zerop kubed-logs-tail-lines)) + kubed-logs-tail-lines)) + timestamps))) (kubed-logs ,(symbol-name plrl-var) ,resource context namespace container follow limit prefix since tail timestamps)))) @@ -1535,7 +1597,7 @@ a prefix argument \\[universal-argument], prompt for CONTEXT too." `(defun ,(intern (format "kubed-%S-%S" plrl-var suffix)) (,click-var) ,(format "%s Kubernetes %S at point." desc resource) (interactive (list last-nonmenu-event) ,mod-name) - (if-let ((,resource (tabulated-list-get-id (mouse-set-point ,click-var)))) + (if-let ((,resource (tabulated-list-get-id (kubed--event-point ,click-var)))) (progn ,@body) (user-error ,(format "No Kubernetes %S at point" resource))))) commands)) @@ -1571,7 +1633,7 @@ a prefix argument \\[universal-argument], prompt for CONTEXT too." (defun ,ctxt-fun (menu . ,(if commands '(click) '(_click))) ,@(when commands - `((when (tabulated-list-get-entry (posn-point (event-start click))) + `((when (tabulated-list-get-entry (kubed--event-point click)) ,@(mapcar (pcase-lambda (`(,suffix ,_key ,desc . ,_body)) `(define-key @@ -1598,9 +1660,12 @@ a prefix argument \\[universal-argument], prompt for CONTEXT too." (defun ,buff-fun (context . ,(when namespaced '(namespace))) (let ((buf-name (format ,(format "*Kubed %S%%s*" plrl-var) - ,(if namespaced - `(concat "@" namespace "[" context "]") - `(concat "[" context "]"))))) + (concat + ,(if namespaced + `(concat "@" namespace "[" context "]") + `(concat "[" context "]")) + (when-let ((host (file-remote-p default-directory))) + (concat " from " host)))))) (if-let ((buf (get-buffer buf-name))) buf (with-current-buffer (get-buffer-create buf-name) (,mod-name) @@ -1699,7 +1764,10 @@ Interactively, use the current context. With a prefix argument (defun kubed-remote-file-name (context namespace pod &optional file-name) "Return remote FILE-NAME for POD in NAMESPACE and CONTEXT." - (concat "/" kubed-tramp-method ":" + (concat (if-let ((host (file-remote-p default-directory))) + (concat (substring host 0 (1- (length host))) "|") + "/") + kubed-tramp-method ":" (kubed--encode-context-name context) "%" namespace "%" pod "%" (kubed-read-container pod "Container" t context namespace) ":" file-name)) @@ -1825,8 +1893,8 @@ With a prefix argument, prompt for CONTEXT instead." cxt)))) (list (read-string "Create namespace with name: ") context))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "create" "namespace" name (when context (list "--context" context)))) (user-error "Failed to create Kubernetes namespace with name `%s'" name)) @@ -1905,8 +1973,8 @@ defaulting to the current namespace." (let* ((context (or context (kubed-local-context))) (namespace (or namespace (kubed--namespace context)))) (unless (zerop - (call-process - kubed-kubectl-program nil nil nil + (process-file + (kubed-kubectl-program) nil nil nil "create" "job" name "--from" (concat "cronjob/" cronjob) "-n" namespace "--context" context)) (user-error "Failed to create Kubernetes job `%s'" name)) @@ -1956,8 +2024,8 @@ defaulting to the current namespace." (setq image (kubed-read-container-image "Image to run in job"))) (list name image context namespace command))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "create" "job" name "--image" image (append (when namespace (list "-n" namespace)) @@ -2003,7 +2071,8 @@ NAMESPACE too. With a double prefix argument, also prompt for CONTEXT." (make-process :name "*kubed-watch-deployment-status*" :buffer buf - :command (list kubed-kubectl-program "rollout" "status" + :file-handler t + :command (list (kubed-kubectl-program) "rollout" "status" "deployment" dep "-n" namespace "--context" context) :sentinel (when cb (lambda (_proc status) @@ -2049,8 +2118,8 @@ NAMESPACE too. With a double prefix argument, also prompt for CONTEXT." (let* ((context (or context (kubed-local-context))) (namespace (or namespace (kubed--namespace context)))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "scale" "deployment" dep "--replicas" (number-to-string reps) (append @@ -2090,10 +2159,11 @@ NAMESPACE too. With a double prefix argument, also prompt for CONTEXT." context namespace) context namespace))) (let* ((context (or context (kubed-local-context))) - (namespace (or namespace (kubed--namespace context)))) + (namespace (or namespace (kubed--namespace context))) + (host (file-remote-p default-directory))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "rollout" "restart" "deployment" dep (append (when namespace (list "-n" namespace)) @@ -2104,7 +2174,7 @@ NAMESPACE too. With a double prefix argument, also prompt for CONTEXT." (kubed-watch-deployment-status dep context namespace (lambda () - (kubed-update "deployments" context namespace)))))) + (kubed-update "deployments" context namespace host)))))) ;;;###autoload (autoload 'kubed-display-deployment "kubed" nil t) ;;;###autoload (autoload 'kubed-edit-deployment "kubed" nil t) @@ -2179,8 +2249,8 @@ optional command to run in the images." (let* ((context (or context (kubed-local-context))) (namespace (or namespace (kubed--namespace context)))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "create" "deployment" name (append (mapcar (lambda (image) (concat "--image=" image)) images) @@ -2272,13 +2342,15 @@ optional command to run in the images." (defun kubed-cronjob-suspended-p (cj &optional context ns) "Return non-nil if cronjob CJ in CONTEXT and namespace NS is suspended." - (equal (car (apply #'process-lines - kubed-kubectl-program - "get" "cronjobs" cj - "-o" "custom-columns=SUSPENDED:.spec.suspend" "--no-headers" - (append - (when ns (list "-n" ns)) - (when context (list "--context" context))))) + (equal (car (with-temp-buffer + (apply #'process-file + (kubed-kubectl-program) nil t nil + "get" "cronjobs" cj + "-o" "custom-columns=SUSPENDED:.spec.suspend" "--no-headers" + (append + (when ns (list "-n" ns)) + (when context (list "--context" context)))) + (string-lines (buffer-string) t))) "true")) ;;;###autoload (autoload 'kubed-display-cronjob "kubed" nil t) @@ -2334,8 +2406,8 @@ overrides the default command IMAGE runs." (setq schedule (read-string "Cron schedule: " "* * * * *"))) (list name image schedule context namespace command))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "create" "cronjob" name "--image" image "--schedule" schedule (append @@ -2421,8 +2493,8 @@ DEFAULT-BACKEND is the service to use as a backend for unhandled URLs." (unless rules (setq rules (kubed-read-ingress-rules))) (list name rules context namespace class default-backend annotations))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "create" "ingress" name (append (mapcan (lambda (rule) (list "--rule" rule)) rules) @@ -2449,11 +2521,18 @@ DEFAULT-BACKEND is the service to use as a backend for unhandled URLs." (defun kubed-contexts () "Return list of Kubernetes contexts." - (process-lines kubed-kubectl-program "config" "get-contexts" "-o" "name")) + (with-temp-buffer + (process-file (kubed-kubectl-program) nil t nil + "config" "get-contexts" "-o" "name") + (string-lines (buffer-string) t))) (defun kubed-current-context () "Return current Kubernetes context." - (car (process-lines kubed-kubectl-program "config" "current-context"))) + (car (with-temp-buffer + (unless (zerop (process-file (kubed-kubectl-program) nil t nil + "config" "current-context")) + (error "Failed to get current `kubectl' context")) + (string-lines (buffer-string) t)))) (defun kubed-read-default-namespace-non-empty (context) "Prompt for a default namespace for CONTEXT, refusing empty input." @@ -2466,12 +2545,13 @@ DEFAULT-BACKEND is the service to use as a backend for unhandled URLs." (defun kubed-default-context-and-namespace () "Return default context and namespace as a cons cell (CONTEXT . NAMESPACE)." - (or kubed-default-context-and-namespace - (setq kubed-default-context-and-namespace - (let ((context (kubed-current-context))) - (cons context - (or (kubed-current-namespace context) - (kubed-read-default-namespace-non-empty context))))))) + (let ((host (file-remote-p default-directory))) + (or (alist-get host kubed-default-context-and-namespace-alist nil nil #'equal) + (setf (alist-get host kubed-default-context-and-namespace-alist nil nil #'equal) + (let ((context (kubed-current-context))) + (cons context + (or (kubed-current-namespace context) + (kubed-read-default-namespace-non-empty context)))))))) (defun kubed-default-context () "Return default `kubectl' context." @@ -2508,15 +2588,27 @@ Optional argument DEFAULT is the minibuffer default argument." ;;;###autoload (defun kubed-use-context (context) - "Set current Kubernetes context to CONTEXT." + "Set default `kubectl' context to CONTEXT. + +This command sets the global `kubectl' default context, and updates the +value of `kubed-default-context-and-namespace-alist' accordingly. + +Interactively, prompt for CONTEXT with completion." (interactive (list (kubed-read-context "Use context" (kubed-local-context)))) (unless (zerop - (call-process - kubed-kubectl-program nil nil nil + (process-file + (kubed-kubectl-program) nil nil nil "config" "use-context" context)) (user-error "Failed to use Kubernetes context `%s'" context)) - (message "Now using Kubernetes context `%s'." context)) + (let ((namespace (or (kubed-current-namespace context) + (kubed-read-namespace + (format "Default namespace to use in context `%s'" context) + nil nil context)))) + (setf (alist-get (file-remote-p default-directory) + kubed-default-context-and-namespace-alist nil nil #'equal) + (cons context namespace)) + (message "Default context is now `%s', namespace `%s'." context namespace))) ;;;###autoload (defun kubed-rename-context (old new) @@ -2526,8 +2618,8 @@ Optional argument DEFAULT is the minibuffer default argument." (list old (read-string (format-prompt "Rename context to" old) nil 'kubed-context-history old)))) (unless (zerop - (call-process - kubed-kubectl-program nil nil nil + (process-file + (kubed-kubectl-program) nil nil nil "config" "rename-context" old new)) (user-error "Failed to rename Kubernetes context `%s' to `%s'" old new)) (message "Renamed Kubernetes context `%s' to `%s'." old new)) @@ -2543,8 +2635,8 @@ Optional argument DEFAULT is the minibuffer default argument." (buffer-disable-undo) (with-temp-buffer (unless (zerop - (call-process - kubed-kubectl-program nil t nil "config" "view")) + (process-file + (kubed-kubectl-program) nil t nil "config" "view")) (error "`kubectl config view' failed")) (let ((source (current-buffer))) (with-current-buffer target @@ -2562,11 +2654,13 @@ Optional argument DEFAULT is the minibuffer default argument." "Return current Kubernetes namespace for context CONTEXT. If no namespace is configured for CONTEXT, return nil." - (or (car (process-lines - kubed-kubectl-program - "config" "view" "-o" - (format "jsonpath={.contexts[?(.name==\"%s\")].context.namespace}" - (or context (kubed-current-context))))))) + (car + (with-temp-buffer + (process-file (kubed-kubectl-program) nil t nil + "config" "view" "-o" + (format "jsonpath={.contexts[?(.name==\"%s\")].context.namespace}" + (or context (kubed-current-context)))) + (string-lines (buffer-string) t)))) (defun kubed-local-namespace () "Return Kubernetes namespace in CONTEXT local to the current buffer." @@ -2595,6 +2689,10 @@ If no namespace is configured for CONTEXT, return nil." (defun kubed-set-namespace (namespace &optional context) "Set default Kubernetes namespace in CONTEXT to NAMESPACE. +If CONTEXT is the current default context, also update the value of user +option `kubed-default-context-and-namespace-alist' to use NAMESPACE as +the default namespace. + Interactively, prompt for NAMESPACE and use the current context. With a prefix argument, prompt for CONTEXT as well." (interactive @@ -2605,17 +2703,21 @@ prefix argument, prompt for CONTEXT as well." (list (kubed-read-namespace "Set namespace" (kubed--namespace context) nil context) context))) - (unless (zerop - (call-process - kubed-kubectl-program nil nil nil - "config" "set-context" (or context "--current") - "--namespace" namespace)) - (user-error "Failed to set Kubernetes namespace to `%s'" namespace)) - (message "Default Kubernetes namespace%s is now `%s'." - (if context - (substitute-quotes (concat " for context `" context "'")) - "") - namespace)) + (let ((context (or context (kubed-local-context)))) + (unless (zerop + (process-file + (kubed-kubectl-program) nil nil nil + "config" "set-context" context + "--namespace" namespace)) + (user-error "Failed to set Kubernetes namespace to `%s' in context `%s'" + namespace context)) + (let ((host (file-remote-p default-directory))) + (when (equal context + (car (alist-get host kubed-default-context-and-namespace-alist nil nil #'equal))) + (setf (alist-get host kubed-default-context-and-namespace-alist nil nil #'equal) + (cons context namespace)))) + (message "Default Kubernetes namespace for context `%s' is now `%s'." + context namespace))) (defcustom kubed-read-resource-definition-filter-files-by-kind t "Whether to filter file completion candidates by their Kubernetes \"kind\". @@ -2637,7 +2739,7 @@ completion candidates." (read-file-name (format "%s definition file: " (or kind "Resource")) nil nil t nil (if (and kind kubed-read-resource-definition-filter-files-by-kind - (executable-find "grep")) + (executable-find "grep" t)) (let ((cache (make-hash-table :test 'equal))) (lambda (f) (or (file-directory-p f) @@ -2647,18 +2749,20 @@ completion candidates." (pcase (gethash (expand-file-name f) cache 'noval) ('noval (puthash (expand-file-name f) - (zerop (call-process - "grep" f nil nil "-i" - (format "^kind: %s$" kind))) + (zerop (process-file + "grep" nil nil nil "-i" + (format "^kind: %s$" kind) + (file-local-name (expand-file-name f)))) cache)) (val val))) (and (equal ext "json") (pcase (gethash (expand-file-name f) cache 'noval) ('noval (puthash (expand-file-name f) - (zerop (call-process - "grep" f nil nil "-i" - (format "^kind: %s$" kind))) + (zerop (process-file + "grep" nil nil nil "-i" + (format "^kind: %s$" kind) + (file-local-name (expand-file-name f)))) cache)) (val val)))))))) (lambda (f) @@ -2690,7 +2794,7 @@ completion candidates." (let ((kind (or kind "resource")) (context (or context (kubed-local-context)))) (message "Applying Kubernetes %s configuration `%s'..." kind config) - (call-process kubed-kubectl-program nil nil nil + (process-file (kubed-kubectl-program) nil nil nil "apply" "-f" (expand-file-name config) "--context" context) (message "Applying Kubernetes %s configuration `%s'... Done." kind config))) @@ -2718,10 +2822,13 @@ completion candidates." (message "Creating Kubernetes %s with definition `%s'..." kind definition) (message "Creating Kubernetes %s with definition `%s'... Done. New %s name is `%s'." kind definition kind - (car (apply #'process-lines kubed-kubectl-program - "create" "-f" (expand-file-name definition) - "-o" "jsonpath={.metadata.name}" - (when context (list "--context" context))))))) + (car (with-temp-buffer + (apply #'process-file + (kubed-kubectl-program) nil t nil + "create" "-f" (expand-file-name definition) + "-o" "jsonpath={.metadata.name}" + (when context (list "--context" context))) + (string-lines (buffer-string) t)))))) ;;;###autoload (defun kubed-run @@ -2782,7 +2889,7 @@ for NAMESPACE; with a double prefix argument, also prompt for CONTEXT." (list pod image context namespace port attach stdin tty rm envs command args))) (if attach (pop-to-buffer - (apply #'make-comint "kubed-run" kubed-kubectl-program nil + (apply #'make-comint "kubed-run" (kubed-kubectl-program) nil "run" pod (concat "--image=" image) "--attach" (append (mapcar (lambda (env) (concat "--env=" env)) @@ -2795,8 +2902,8 @@ for NAMESPACE; with a double prefix argument, also prompt for CONTEXT." (when command '("--command")) (when args (cons "--" args))))) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "run" pod (concat "--image=" image) (append (mapcar (lambda (env) (concat "--env=" env)) envs) @@ -2816,24 +2923,28 @@ for NAMESPACE; with a double prefix argument, also prompt for CONTEXT." (defun kubed-pod-containers (pod &optional context namespace) "Return list of containers in Kubernetes pod POD in NAMESPACE in CONTEXT." - (string-split - (car (apply #'process-lines - kubed-kubectl-program "get" - "pod" pod "-o" "jsonpath={.spec.containers[*].name}" - (append - (when namespace (list "--namespace" namespace)) - (when context (list "--context" context))))) + (split-string + (car (with-temp-buffer + (apply #'process-file + (kubed-kubectl-program) nil t nil + "get" "pod" pod "-o" "jsonpath={.spec.containers[*].name}" + (append + (when namespace (list "--namespace" namespace)) + (when context (list "--context" context)))) + (string-lines (buffer-string) t))) " ")) (defun kubed-pod-default-container (pod &optional context namespace) "Return default container of Kubernetes pod POD in NAMESPACE in CONTEXT." - (car (apply #'process-lines - kubed-kubectl-program - "get" "pod" pod "-o" - "jsonpath={.metadata.annotations.kubectl\\.kubernetes\\.io/default-container}" - (append - (when namespace (list "--namespace" namespace)) - (when context (list "--context" context)))))) + (car (with-temp-buffer + (apply #'process-file + (kubed-kubectl-program) nil t nil + "get" "pod" pod "-o" + "jsonpath={.metadata.annotations.kubectl\\.kubernetes\\.io/default-container}" + (append + (when namespace (list "--namespace" namespace)) + (when context (list "--context" context)))) + (string-lines (buffer-string) t)))) (defun kubed-read-container (pod prompt &optional guess context namespace) @@ -2911,7 +3022,15 @@ argument, also prompt for CONTEXT." (and (string= type "pods") (kubed-read-container resource "Container" t context namespace))) - follow limit prefix since tail timestamps))) + (or follow + (unless (bound-and-true-p transient-current-command) + kubed-logs-follow)) + limit prefix since + (or tail + (unless (or (bound-and-true-p transient-current-command) + (zerop kubed-logs-tail-lines)) + kubed-logs-tail-lines)) + timestamps))) (let* ((context (or context (kubed-local-context))) (namespace (or namespace (kubed--namespace context))) (buf (generate-new-buffer @@ -2923,8 +3042,8 @@ argument, also prompt for CONTEXT." (t "")) namespace context)))) (with-current-buffer buf (run-hooks 'kubed-logs-setup-hook)) - (apply #'start-process "*kubed-logs*" buf - kubed-kubectl-program "logs" (concat type "/" resource) + (apply #'start-file-process "*kubed-logs*" buf + (kubed-kubectl-program) "logs" (concat type "/" resource) "--context" context "-n" namespace (append (cond @@ -2970,9 +3089,9 @@ argument, also prompt for CONTEXT." (push (cons (format "%s %d:%d in %s[%s]" pod local-port remote-port namespace context) - (apply #'start-process + (apply #'start-file-process "*kubed-port-forward*" nil - kubed-kubectl-program "port-forward" + (kubed-kubectl-program) "port-forward" pod (format "%d:%d" local-port remote-port) (append (when namespace (list "-n" namespace)) @@ -3038,7 +3157,7 @@ them as list." (defun kubed-transient-args (&optional prefix) "Return current arguments from transient PREFIX. -If PREFIX nil, it defaults to the value of `transient-current-command'." +If PREFIX is nil, it defaults to the value of `transient-current-command'." (when-let ((prefix (or prefix (bound-and-true-p transient-current-command)))) (and (featurep 'kubed-transient) (fboundp 'transient-args) @@ -3078,7 +3197,7 @@ STDIN and TTY are t interactively." (c (kubed-read-container p "Container" t context namespace))) (list p c context namespace stdin tty)))) (pop-to-buffer - (apply #'make-comint "kubed-attach" kubed-kubectl-program nil + (apply #'make-comint "kubed-attach" (kubed-kubectl-program) nil "attach" pod (append (when namespace (list "-n" namespace)) @@ -3128,10 +3247,14 @@ argument) says to include managed fields in the comparison." (delete-region (point-min) (point-max)) (fundamental-mode) (if (bufferp definition) - (with-current-buffer definition - (apply #'call-process-region nil nil kubed-kubectl-program - nil buf nil args)) - (apply #'call-process kubed-kubectl-program + (let ((tmpfile (make-temp-file "kubed"))) + (unwind-protect + (with-current-buffer definition + (write-region (point-min) (point-max) tmpfile) + (apply #'process-file (kubed-kubectl-program) + tmpfile buf nil args)) + (delete-file tmpfile))) + (apply #'process-file (kubed-kubectl-program) nil t nil args)) (setq buffer-read-only t) (diff-mode) @@ -3182,7 +3305,7 @@ STDIN and TTY are t interactively." (c (kubed-read-container p "Container" t context namespace))) (list p command c context namespace stdin tty args)))) (pop-to-buffer - (apply #'make-comint "kubed-exec" kubed-kubectl-program nil + (apply #'make-comint "kubed-exec" (kubed-kubectl-program) nil "exec" pod (append (when namespace (list "-n" namespace)) @@ -3234,8 +3357,8 @@ for CONTEXT." (kubed-read-patch) context namespace strategy))) (message "Applying patch to `%s'..." name) (unless (zerop - (apply #'call-process - kubed-kubectl-program nil nil nil + (apply #'process-file + (kubed-kubectl-program) nil nil nil "patch" type name "-p" patch (append (when namespace (list "-n" namespace)) @@ -3293,8 +3416,8 @@ local context." (user-error "Proxy already running for context `%s'" context)) (message "Stopped proxy for context `%s'." context)) (setf (alist-get context kubed--proxy-alist nil nil #'string=) - (apply #'start-process (format "*kubed-proxy[%s]*" context) nil - kubed-kubectl-program "proxy" + (apply #'start-file-process (format "*kubed-proxy[%s]*" context) nil + (kubed-kubectl-program) "proxy" "--context" context (append (when addr (list "--address" addr)) @@ -3347,20 +3470,26 @@ resource types." (mapcar (lambda (line) (car (split-string line))) - (apply #'process-lines - kubed-kubectl-program - "api-resources" "--no-headers" - (append - (when only-namespaced '("--namespaced=true")) - (when context (list (concat "--context=" context))))))) + (with-temp-buffer + (apply #'process-file + (kubed-kubectl-program) nil t nil + "api-resources" "--no-headers" + (append + (when only-namespaced '("--namespaced=true")) + (when context (list (concat "--context=" context))))) + (string-lines (buffer-string) t)))) (defun kubed-resource-names (type context &optional namespace) "Return list of Kubernetes resources of type TYPE in NAMESPACE via CONTEXT." - (unless (kubed--alist type context namespace) + (unless (kubed--alist (file-remote-p default-directory) type context namespace) (let ((proc (kubed-update type context namespace))) (while (process-live-p proc) (accept-process-output proc 1)))) - (mapcar #'car (alist-get 'resources (kubed--alist type context namespace)))) + (mapcar #'car + (alist-get 'resources + (kubed--alist + (file-remote-p default-directory) + type context namespace)))) (defun kubed-read-resource-name (type prompt &optional default multi context namespace) "Prompt with PROMPT for Kubernetes resource name of type TYPE. @@ -3412,8 +3541,8 @@ CONTEXT is the `kubectl' context to use." (kubed-api-resources context) ;; Complete (sub-)field name. (with-temp-buffer - (call-process - kubed-kubectl-program nil t nil + (process-file + (kubed-kubectl-program) nil t nil "explain" (substring s 0 start)) (goto-char (point-min)) (let ((res nil)) @@ -3451,7 +3580,7 @@ CONTEXT is the `kubectl' context to use." nil t) (help-xref-button 1 'kubed-explain (match-string 1)))) - (call-process kubed-kubectl-program nil t nil "explain" field) + (process-file (kubed-kubectl-program) nil t nil "explain" field) ;; Buttonize references to other fields. (goto-char (point-min)) (while (re-search-forward (rx line-start @@ -3471,12 +3600,13 @@ CONTEXT is the `kubectl' context to use." (defun kubed-read-kubectl-command (prompt &optional initial) "Prompt with PROMPT for a `kubectl' command line. -Optional argument INITIAL added to the initial minibuffer input +Optional argument is INITIAL added to the initial minibuffer input following the value of `kubed-kubectl-program' and a space character." - (let ((init (if (consp initial) - (cons (concat kubed-kubectl-program " " (car initial)) - (+ (length kubed-kubectl-program) 1 (cdr initial))) - (concat kubed-kubectl-program " " initial)))) + (let* ((kubectl (kubed-kubectl-program)) + (init (if (consp initial) + (cons (concat kubectl " " (car initial)) + (+ (length kubectl) 1 (cdr initial))) + (concat kubectl " " initial)))) (cobra-read-command-line prompt init 'kubed-kubectl-command-history))) ;;;###autoload @@ -3494,8 +3624,11 @@ Interactively, prompt for COMMAND with completion for `kubectl' arguments." (transient-prefix-object))) (scope (and prefix (fboundp 'eieio-oref) (eieio-oref prefix 'scope)))) - (when (or args scope) - (concat (string-join (append scope args) " ") " ")))))) + (or + (seq-find (apply-partially #'string-prefix-p "--context=") args) + ;; No context argument, add one. + (push (concat "--context=" (kubed-local-context)) args)) + (concat (string-join (append scope args) " ") " "))))) (shell-command command)) ;;;###autoload (autoload 'kubed-prefix-map "kubed" nil t 'keymap) @@ -3510,6 +3643,8 @@ Interactively, prompt for COMMAND with completion for `kubectl' arguments." "d" 'kubed-deployment-prefix-map "i" 'kubed-ingress-prefix-map "c" 'kubed-cronjob-prefix-map + "k" #'kubed-transient + "L" #'kubed-logs "C" #'kubed-use-context "+" #'kubed-create "*" #'kubed-apply @@ -3543,6 +3678,7 @@ Interactively, prompt for COMMAND with completion for `kubectl' arguments." "" '("Invoke kubectl" . kubed-kubectl-command) "" '("Explain Type or Field" . kubed-explain) "" '("Set Current Context" . kubed-use-context) + "" '("View Logs" . kubed-logs) "" '("Run Image" . kubed-run) "" '("Apply Config" . kubed-apply) "" '("Create Resource" . kubed-create) diff --git a/elpa/kubed-0.5.0/kubed.info b/elpa/kubed-0.6.1/kubed.info similarity index 70% rename from elpa/kubed-0.5.0/kubed.info rename to elpa/kubed-0.6.1/kubed.info index afd891ea828590a2adfb1206aae8e1d347857842..a19006967de56277aaf766345da50908d861f522 100644 GIT binary patch delta 8364 zcma)BU2GiJb;eR6X^kjHl0{mkEa{rI#ihz6_lLVnu3}po!@pW%-6-8X^whrmRGO7N zr_Sy^8{d%aPbTfJ(1Ywt&~*6hG&EO*Hc3{Nix zY|{*?tY|fSJo_xDdQPKKWu8%Y0)wr2dfjD3$F_}PU^+IxG1jkxGy%&|5N++ z{_%j7O}m8620u46%74877jdYMkRLLOz#hT%zr3xz37JE>hTEu$da-Fjo_mwWliwPXCFkB=YdKG|=b zi=T`kK*fnaiH(2w(CPk`HvQTG6+G|D7Cviz_RPOL6c=EbGVQW6$=I?}g3UdG=&i98 z6!;hR2-hzD#=||IYJ5BXSZEo6&zcDMhG}dv%c=OxDN|?z-Lwf;Ucxdew7!U}U6rFlq2k6R<$Ij5P zBuSi%98nTWfKGA+b8w_PyF5^BPH4@ zL9<$Qlu>lpgRRoL>_YZP2nf9+&_@dEeoguc!g%uNaA@mwW0H|AuH*Ww;R46&4Z^WJ zUSue_BJwN!{a`JEsvdMs*J%GGyZwS$CLAb5Q>tUF-*7|M@d6<`k?!z#pb*9vxF zQ_yscL{t={O9M~0eG|qpSlAF|OU?Pw^q0a(xxF2Qwn453L52le3__?-P*ywo1hH&b zI#QXuAVol(L;@LM5yHuL;zil9EN7Em$+GCnqK?l*X4V9T#kPcnWFk1z=C(+&N-k=P zitrwVMK9e%foJOmqGBKkH=G(}V_P$YP5$Z2$LE2WwM|h^y|zY#HqWs{KubnhZ&)O( zs&ANxGBO>4fEOjjFYweA)CA;Dm)cU_YSPE>yHpKfDEZ(lFwi9(6h)>cPBw0$*EsN2)99YrYI zz!B7{n*mQ=8I|@(56i7Lss`)^%AvD}p#UU_fK8qWYj)^@i~(O5 ziZf)zEIm&>w5K`(Gr4K{e9}} zpKt$wIku)sejxFVaP$a+ZNj;DshpoEg`zS!UXuE;jo-W~2Mcovi8zDkK6bOW;igbXA3-}AcL+(~lmQ4V_*|ar~ zEd$l8M7cv@g!#S4bsPom6%_&BtRruA+i)7b)nuEFSJOmQYeV3=-(iBDfuluI2#y&M zD=2b5chb7KlYnKN>P*R?V&@}!@>v;ViLP_L?-WhxP|=d=y6Z}mf|gM}!7--CO5DEk z_&&J@^?;vU84YFNqe>Hbh!Uq|+b$Z&ZTKa=xU#y&rr7+-^4h|0t|iVbpHD2G zySlJ??cDqVp_i&9NFx*L5OxE(kG$69$v$!!8Dx^T&9L00hi=-c^p#PHBTAkTG>}mx zw%(KyphFoDNyy+QTydl^Re|>SXxjIy1+Z7|tnbu~DROTCD}W}{R(x*Dej)qmglZ)c zC$ttq9%vZ`_y%m>Z}|u5QKXL@WaF*bppZrNwfuoVv_xGX%dsUtmMGS~o7CKMn?;7WCe0!EC^ zp`=!s#YHJhRFKm+pLAT5I!<&gm7B(YooY}lkzmo7R3Kse{gr|FXpW?+v+g^f?nYpo; z%O=RI>%|%>c!{`!i;A#rT4sRSL_;a%gcK6tNR$jhB$(?}DtrQ)(ZCp$-wqH^`O!(> z(>DyIIYFA=<0#B%ws-?g_`Rjvv$AWdF;+oa zBO=pA4DIQ#jgF%5#wGsT)zL?_DEY*2BWfW6#JGEPYKUgcx^#`sKX~aV|K#e}VXae` z)rtH&SC8>S%O_$QPcA11l~VlmbJ5;dJY zU|ZKbV}n0;W4M=gJqt9aW3fGowt(=cnqiqQk*e?gU<<> zl0#};H%UlR!Od)tjU8+PrA1xKL|kW*g}^3t2VGOKR0^23AAqGxx*$^DLia&2rD;y7 zChDsPe~aQq%m#sPYL6ioSwl^BMrnf2Y(PQ<&w|0`OlX3he|fNv(0e-5806)+rnAgoHC}wG=Ut_ zrQ0;&FDhnjs!PE!^wNVUc8J80v=+tPBR@H|@P>50rpSwkSlz$`F6(;49pqhs1U4Zl zQc?7JG$t3QLWnm^ABhDYw--bi7U~zCz#*FCD#^iMdZ~9d0R5N5OTUG-E6Ah5iL&`-=j~e2^PD7MA zK{H!O+0Z?h_TDN{#?y2S-(uL2*I-C4n(09)#3<2rG@U&uPFA-#1TEN&8d5^Th9~6) z;+f=rBv4%sYgiIsPBB1C0xkz&-|iix-@6XWDrcj0JrfBjsO1s$1WfZ zh}*YECy8qG>xf|++G}`Hm+X>2yw;%|ihT1g_8*%kCt$8JygCL%Xt+r)WC`dk+(2Y! z^n-9k#1UuQj6W8(gO6Ae5o_lL#04}sNgeS7Qw69y_?;4EW*Uuiy34OH5)o_9FbEhf z2utEy0Y$_q-vUR2Gd=$5>rYRkzUzrsY_6?2d8rbhepcmbidOmz()6k!E5r?auP)nkIFr$A12*B6KP zUYPv%%YU(NY*muwvDRO|V)U!4`k7*@PjQ4Vj323&@0Z`(6U*`N<}kl`zZ< zry2iw>KOmS>Ja~O?RYH157id?XT|%!&!6J&)J`19(35l|&EDeTkbkh}Xzz6mP$7Qe zbS=kNI>|q*EyiZ~f8ckLXRSrZ{yKgq`QPAoo*%5s-zRuIb%4K9Ki;1dr@EP8{^#}S z{;YWVVCo3}EB6q8?dFNTnH-<77x_!(e*UigY%I-JoJaZ3ZMQF&Z6JMSLM z=eqQztE*ey=o3(_hobJ#HkIPKyU3Rvi2m9^zE$}W|3~*H@X|MKT_m}GcWW`0YCY;b z8G}VeIoTKsQEWNMp{> zle?Lh7T8;g*6xn%8GiN6i-Y+&vcplQ^<|U%-kXa9LXI1~oK5jtzqL4!rK6cz4bJI-8zm`SbA%5KscZgZOqT`U*M&1p2NmC8i#p1!C?l+{4@@a0UHPNnD6dT{|AW@cd9TenBKeS81jnPeu1 zhj@QBmCS1V?(oQ3n9b*-9nX8tCdQHoaDJFd&dg<%xFz~V?Sg5cA&04KKABVRqt)~! zFm}vlvKjuX+sFIU$@JVTfBeqTmu6pF delta 1839 zcma)6TWl0%6wXX{7dmaRcY0adA1c}{rS9xycDCUn(86$u3zSk23Z32kcRR41+04!^ zt;8-`djTuZ9GkEeQ`!CjZWV z&UeoF&SlSytMoTRbkWXkDTc@!R03_i?4I^@V+Akda!ou6sY(ws)?AGc*X1p^E2X5sq&g;(jEnWIxslXoKhdnxa? z5{9W|Hb@cNoTZ?v1+ymb7x%+2#a9UMG@L21nUU6w8U5RmFby*s%V2wXWAQUg&zHBF z3ulf_Z;AV{Dq{`DW{##{wt92LQ$o}t#i9|hk0^DYb+g5wqrbnj)B+dl_hu>&46ucZ^}6N1nsmx87Gy2;@Ty4KLjQ5~?+deX=4_X+2-y6rKd-fgRv%rc6MWw5F>Gnln|)} z>6sGMBt?cmhX>Aftjf(w?svQbKX>MuP)Je1v%5AA8RZD3U4po~44U?Fkblq$uWx78 zkoroRF#=*Frl5c#C$Mbz6(ffEoFx&@@j#k_B3NVklsF1>D@qJQ^k6yc>8u7@V-eJL z*2DdMdCw6q8tx@tLx><55Ib240d(5o&JL@IxMlReI;ZE&44ga=q+I%g11IR^jYg-@ z)9u=-gpEcbO%>&sLWTnim@pmIx^oNphN8IHLH)2y+Pc^@veKszgQstFX3u zG5k=_m)CtMgFhMULo!9DT@?c(5z zkzupTNj#31mO|ChjJlgKWxp1x=C7?Fc%5a)$g&IlH-Aqg9j1)PxslG9p3`_g-YC0(a&b9ffk zObEGY?kjh+?u4(PPal+s&X-BXPH-(Ala)niD8^{vK|i{Pc1V!Jv>i7s^Dg7k;%n#EZk33=D55Z{F|z>Ivjk)Y^xO05ZT)r zR+FsT<@PXez*lWavOLS$A@V^*((blDj?oqnBN(;dXhi8F|648Ta5(K;##3vrhUK6n zhv!yJ(qT}@=+=`xqDua_M$}1%+v)LU6q|@e0LPLJ&i+KUAub1u#f69x_bwqiVv)h` u5>-j`6B21%(&6Pu?bn{GsIfcQ$5kT10ywH=AWp)Ag~R8Z=2kh_%=`z~wuZ0( diff --git a/elpa/kubed-0.5.0/kubed.texi b/elpa/kubed-0.6.1/kubed.texi similarity index 77% rename from elpa/kubed-0.5.0/kubed.texi rename to elpa/kubed-0.6.1/kubed.texi index 86e6e1c1..6db39ad8 100644 --- a/elpa/kubed-0.5.0/kubed.texi +++ b/elpa/kubed-0.6.1/kubed.texi @@ -11,9 +11,9 @@ @c %**end of header @copying -This manual is for Kubed 0.5.0, a rich Emacs interface for Kubernetes. +This manual is for Kubed 0.6.1, a rich Emacs interface for Kubernetes. -Copyright @copyright{} 2024-2025 Eshel Yaron. +Copyright @copyright{} 2024-2026 Eshel Yaron. @quotation Permission is granted to copy, distribute and/or modify this document @@ -40,7 +40,7 @@ Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. @node Top @top Kubed: Kubernetes, Emacs, done! -This manual is for Kubed 0.5.0, a rich Emacs interface for Kubernetes. +This manual is for Kubed 0.6.1, a rich Emacs interface for Kubernetes. @end ifnottex @@ -85,6 +85,8 @@ Create new resources, edit and delete them @item Work with multiple clusters @item +Interact with clusters through remote Tramp connections +@item Get help about various Kubernetes objects @item @dots{} @@ -124,7 +126,10 @@ common @command{kubectl} installations. If Emacs doesn't find the where to find it by customizing @code{kubed-kubectl-program}. @defopt kubed-kubectl-program -Name of @command{kubectl} executable file to use. +Name of @command{kubectl} executable file to use. You can also set this +option as a connection-local variable (@pxref{Connection Variables,,, +emacs}) to use a different @command{kubectl} executable on specific +remote hosts. @xref{Kubed over Tramp}. @end defopt @node Usage @@ -205,9 +210,11 @@ The following sections describe in detail the various Kubed commands. @menu * Display Resource:: * Browse Resources:: +* Resource Logs:: * Context and Namespace:: * Transient Menus:: * Scale Deployment:: +* Kubed over Tramp:: @end menu @node Display Resource @@ -580,6 +587,61 @@ While entering a filter in the minibuffer, @kbd{@key{TAB}} completion is available for column names and values. To clear the filter, just exit the minibuffer with an empty input. +@node Resource Logs +@section Resource Logs + +Kubed lets you view logs of containers running in Kubernetes, using +@command{kubectl logs} under the hood. The most general command for +viewing logs is @code{kubed-logs}, which is bound to @kbd{L} in +@code{kubed-prefix-map} (@pxref{Definition of kubed-prefix-map}): + +@deffn Command kubed-logs +Show logs for containers running in a Kubernetes resource. This command +asks you for a resource type and name, and pops up a buffer with the +logs of the containers running in that resource. +@end deffn + +In resource list buffers that support logs---such as those for pods, +deployments, services, and jobs---you can view logs for the resource +at point directly: + +@table @kbd +@kindex l +@findex kubed-list-logs +@item l +Show logs for the resource at point (@code{kubed-list-logs}). Kubed +opens a new buffer with the log output. + +@kindex L +@item L +Open a type-specific logs transient menu for the resource at point, +with the resource pre-selected. Kubed also pre-populates the +@samp{--tail} and @samp{--follow} options from +@code{kubed-logs-tail-lines} and @code{kubed-logs-follow}, which you +can adjust before invoking the command. @xref{Transient Menus}. +@end table + +Two user options control the default behavior of these commands: + +@defopt kubed-logs-tail-lines +Number of most recent log lines to fetch and show when displaying +Kubernetes logs. The default is 128. Set this option to 0 to show all +available log lines without limit. +@end defopt + +@defopt kubed-logs-follow +Whether to follow new log entries when displaying Kubernetes logs. +The default is @code{t}. +@end defopt + +When Kubed sets up a buffer for displaying logs, it runs the +following hook: + +@defopt kubed-logs-setup-hook +List of functions to call, in order, to set up Kubernetes logs +buffers. The default value is @code{(view-mode)}. +@end defopt + @node Context and Namespace @section Context and Namespace @@ -597,26 +659,64 @@ For Kubed buffers that display a Kubernetes resource (@pxref{Display Resource}) or a list of resources (@pxref{Browse Resources}), the buffer-local context and namespace are the context and namespace of the resources the buffer displays. For non-Kubed buffers, the user -option @code{kubed-default-context-and-namespace} determines the +option @code{kubed-default-context-and-namespace-alist} determines the default local context and namespace. -@defopt kubed-default-context-and-namespace -Default @command{kubectl} context and Kubernetes namespace for Kubed -commands. The value of this option is either a cons cell -@w{@code{(@var{context} . @var{namespace})}} or @code{nil}. If it is -@code{nil}, Kubed initializes this option to a cons cell with the -current @command{kubectl} context and namespace for that context on -the first time Kubed consults this option. +In addition to @command{kubectl} contexts, Kubed is aware of the +@dfn{host} on which it invokes @command{kubectl}. When +@code{default-directory} is a remote location (@pxref{Remote Files,,, +emacs}), Kubed runs @command{kubectl} on that remote host rather than on +the local machine. Each host has its own independent set of +@command{kubectl} contexts, so you can simultaneously work with +Kubernetes clusters reachable from different hosts. +@xref{Kubed over Tramp} for more details. + +@defopt kubed-default-context-and-namespace-alist +Association list mapping hosts to their default @command{kubectl} +context and Kubernetes namespace for Kubed commands. Each entry is a +cons cell @w{@code{(@var{host} . @var{context-and-namespace})}}, where +@var{host} is either a string identifying a connection to the host (as +returned by @code{file-remote-p}, e.g. @file{/ssh:user@@some.host:}), or +@code{nil} for the local host. @var{context-and-namespace} is either a +cons cell @w{@code{(@var{context} . @var{namespace})}}, or @code{nil}. +If it is @code{nil}, Kubed initializes the entry to a cons cell with the +current @command{kubectl} context and the default namespace of that +context on the first time Kubed consults this option for the given +@var{host}. + +For example, you can configure Kubed to use the @code{my-context} +context and @code{my-namespace} namespace on the local host by default +as follows: + +@lisp +(setopt kubed-default-context-and-namespace-alist + '((nil . ("my-context" . "my-namespace")))) + +;; Or, if you want to preserves other entries: + +(setf (alist-get nil kubed-default-context-and-namespace-alist) + '("my-context" . "my-namespace")) +@end lisp + @end defopt -As mentioned above, most Kubed commands use the local context and -namespace by default---it is also conventional for Kubed commands to -let you choose a different namespace if you invoke them with a prefix -argument (@kbd{C-u}), and to also let you choose a different context -if you invoke them with a double prefix argument (@kbd{C-u C-u}). +@defvar kubed-default-context-and-namespace +This is an obsolete variable that served a similar purpose as +@code{kubed-default-context-and-namespace-alist} prior to Kubed gaining +support for remote hosts. For backward compatibility with user +configurations that set this variable, Kubed by default initializes the +local host entry in @code{kubed-default-context-and-namespace-alist} +from the value of this variable if it is set. +@end defvar -The following functions return the local context and namespace for -buffer in which you call them: +As mentioned above, most Kubed commands use the buffer-local context and +namespace if available by default. It is also conventional for Kubed +commands to let you choose a different namespace if you invoke them with +a prefix argument (@kbd{C-u}), and to also let you choose a different +context if you invoke them with a double prefix argument (@kbd{C-u C-u}). + +The following functions return the buffer-local context and namespace +for the buffer in which you call them: @defun kubed-local-context Return the local @command{kubectl} context for the current buffer. @@ -643,9 +743,9 @@ Additionally, the transient menus allow you to specify options and switches for the commands you invoke, which may not be available when invoking these commands directly. For example, while you can invoke command @code{kubed-logs} directly to view logs from a container -running in Kubernetes, the ``Kubernetes Logs'' transient menu which -you open with @code{kubed-transient-logs} lets you set a maximum -number of logs to retrieve, among other knobs and handles. +running in Kubernetes (@pxref{Resource Logs}), the ``Kubernetes Logs'' +transient menu which you open with @code{kubed-transient-logs} lets you +set a maximum number of logs to retrieve, among other knobs and handles. @float @@ -669,14 +769,17 @@ number of logs to retrieve, among other knobs and handles. Command @code{kubed-transient} opens the Kubed ``root'' transient menu, which is a dispatch that lets you access different transient menus, such as the aforementioned ``Kubernetes Logs'' transient menu. -It's a good idea to bind @code{kubed-transient} to a convenient key, -either in the global keymap or under @code{kubed-prefix-map}: +It's a good idea to bind @code{kubed-transient} to a convenient key: @lisp (keymap-global-set "s-k" #'kubed-transient) -(keymap-set kubed-prefix-map "k" #'kubed-transient) @end lisp +By default, @code{kubed-transient} is bound to @kbd{k} in +@code{kubed-prefix-map}, so if you bind the prefix map to @kbd{C-c k} +you can open the root transient menu with @kbd{C-c k k}. +@xref{Definition of kubed-prefix-map}. + In Kubed resource list buffers, type @kbd{?} to pop up a transient menu with commands that are specific to the type of resources the buffer displays. @xref{Browse Resources}. @@ -720,6 +823,56 @@ Lastly, you can scale deployments using the transient menu @code{kubed-transient-scale-deployment}, which is available from the main Kubed transient by pressing @kbd{$}. @xref{Transient Menus}. +@node Kubed over Tramp +@section Kubed over Tramp + +@cindex remote hosts +@cindex Tramp, Kubed integration +@cindex @command{kubectl} on remote host +Kubed can run @command{kubectl} on remote hosts, letting you manage +Kubernetes clusters that are only reachable from a specific machine, +or use a @command{kubectl} installation that lives on a remote server. +This works by leveraging Emacs's Tramp remote file access facility +(@pxref{Top,,,tramp}). + +Essentially, Kubed respects the value of @code{default-directory} when +deciding where to run @command{kubectl}. When @code{default-directory} +refers to a local directory, Kubed invokes the local @command{kubectl}. +When @code{default-directory} refers to a remote directory (i.e., it is +a Tramp file name), Kubed instead invokes @command{kubectl} on the +corresponding remote host. This means that you can point Kubed at a +remote host simply by visiting a remote directory via Tramp---for +example, by opening a file on a remote server with @kbd{C-x C-f} and +Tramp file name syntax, such as @file{/ssh:user@@some.host:/home/user/}. + +Each remote host has its own independent set of @command{kubectl} +contexts and namespaces. Kubed keeps track of the default context and +namespace per host in the user option +@code{kubed-default-context-and-namespace-alist} +(@pxref{Context and Namespace}). When Kubed list buffers are showing +resources fetched from a remote host, the buffer name includes +@w{@samp{ from @var{host}}} to make it clear which host was used. + +@cindex @code{kubed-kubectl-program}, per-host +You may have @command{kubectl} installed at different paths on different +hosts, or you may want to use a wrapper script instead of the bare +@command{kubectl} executable on some hosts. Kubed consults the +@emph{connection-local} value of option @code{kubed-kubectl-program} to +determine how to invoke @command{kubectl}, so you can configure the +@command{kubectl} executable per host. For example, to tell Kubed to +use @file{/home/user/.local/bin/kubectl} on @samp{some.host}, add the +following to your Emacs initialization file: + +@lisp +(connection-local-set-profile-variables + 'my-kubed-profile-for-somehost + '((kubed-kubectl-program . "/home/user/.local/bin/kubectl"))) + +(connection-local-set-profiles + '(:application kubed :machine "some.host") + 'my-kubed-profile-for-somehost) +@end lisp + @node Extending Kubed @chapter Extending Kubed diff --git a/elpa/kubed-0.6.1/news b/elpa/kubed-0.6.1/news new file mode 100644 index 00000000..3c3099f0 --- /dev/null +++ b/elpa/kubed-0.6.1/news @@ -0,0 +1,146 @@ + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + KUBED NEWS – HISTORY OF USER-VISIBLE CHANGES + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + +This file contains the release notes for Kubed, a rich Emacs interface +for Kubernetes. + +For further details, see the Kubed manual: +[https://eshelyaron.com/kubed.html]. + + +[https://eshelyaron.com/kubed.html] + + +Version 0.6.1 on 2026-04-13 +═══════════════════════════ + + This is a maintenance release, it includes one important bug fix: + + +Fix “Invalid format string” error in Tramp integration +────────────────────────────────────────────────────── + + This version fixes a regression introduced in version 0.6.0, which + caused an error when starting a shell or opening Dired inside a pod. + + See bug report at + + + +Version 0.6.0 on 2026-04-11 +═══════════════════════════ + +Kubed now uses the remote `kubectl' on remote hosts +─────────────────────────────────────────────────── + + When you invoke Kubed commands in a buffer whose `default-directory' + points to a directory on a remote host (such as + `/ssh:user@example.com:/some/remote/dir/'), Kubed runs `kubectl' on + the remote host, so you can interact with clusters that are configured + in the remote kubeconfig and accessible from the remote host. + + Note that this is a rather extensive change, please tell us about + issues/regressions if you see any! + + +`kubed-kubectl-program' is now connection-local +─────────────────────────────────────────────── + + You can configure different `kubed-kubectl-program' values for + different hosts on which you run `kubectl' via Kubed commands, by + giving the variable a connection-local value for certain hosts. For + example: + + ┌──── + │ (connection-local-set-profile-variables + │ 'my-kubed-profile-for-somehost + │ '((kubed-kubectl-program . "/home/user/my-kubectl"))) + │ + │ (connection-local-set-profiles + │ '(:application kubed :machine "somehost.com") + │ 'my-kubed-profile-for-somehost) + └──── + + +New user option `kubed-default-context-and-namespace-alist' +─────────────────────────────────────────────────────────── + + This user option generalizes and supersedes the existing user option + `kubed-default-context-and-namespace', which is considered obsolete + but is still available. The new user option lets you set different + defaults depending on the host on which Kubed is running `kubectl'. + + +Command `kubed-transient' is now bound to `k' in `kubed-prefix-map' +─────────────────────────────────────────────────────────────────── + + This was already a recommended binding for this command, which opens + the “root” Kubed transient menu. + + +New user option `kubed-logs-follow' +─────────────────────────────────── + + The new user option `kubed-logs-follow' controls whether Kubed follows + new log entries by default when showing Kubernetes logs. It defaults + to `t'. + + +New user option `kubed-logs-tail-lines' +─────────────────────────────────────── + + Kubed commands that show logs for Kubernetes resources now fetch only + the most recent 128 log lines by default, to avoid flooding the logs + buffer with the full history of long-running workloads. You can + customize this limit with the new user option `kubed-logs-tail-lines'; + set it to 0 to fetch all available log lines. + + +Command `kubed-logs' is now bound to `L' in `kubed-prefix-map' +────────────────────────────────────────────────────────────── + + +Version 0.5.1 on 2026-02-13 +═══════════════════════════ + +Fix error with minibuffer completion for custom Kubernetes resources +──────────────────────────────────────────────────────────────────── + + +`kubed-use-context' now also updates `kubed-default-context-and-namespace' +────────────────────────────────────────────────────────────────────────── + + Setting the default `kubectl' context with `kubed-use-context' now + also updates the user option `kubed-default-context-and-namespace', + such that Kubed commands will also use the new context as a default. + + +Version 0.5.0 on 2025-06-11 +═══════════════════════════ + +DaemonSets support +────────────────── + + Kubed now provides commands for working with DaemonSets by default. + Remember that you can always configure support for additional resource + types with the `kubed-define-resource' macro! + + +Fix Tramp integration for context names with non-alphanumeric characters +──────────────────────────────────────────────────────────────────────── + + This version fixes an issue in the Kubed integration with Tramp, which + caused it to fail for `kubectl' contexts whose name includes “:” and + most other non-alphanumeric characters. + + See bug report at + + + +Version 0.4.3 on 2025-01-21 +═══════════════════════════ + + This is a maintenance release, it includes minor improvements and one + … … -- 2.47.3