[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master c5d61023130: Adapt Tramp's kubernetes integration
From: |
Michael Albinus |
Subject: |
master c5d61023130: Adapt Tramp's kubernetes integration |
Date: |
Wed, 28 Jun 2023 10:53:13 -0400 (EDT) |
branch: master
commit c5d6102313076b83526dc79bfb563621671fb70b
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Adapt Tramp's kubernetes integration
* doc/misc/tramp.texi (Inline methods): Shorten kubernetes entry.
(Kubernetes setup): New node.
(Top, Configuration): Add it to the menu.
* lisp/net/tramp-container.el (tramp-kubernetes--context-namespace):
Adapt dpcstring.
(tramp-kubernetes-connection-local-default-profile)
(tramp-kubernetes-connection-local-default-variables)
(tramp-flatpak-connection-local-default-profile)
(tramp-flatpak-connection-local-default-variables): Rename.
* lisp/net/tramp.el (tramp-expand-args): Use `tramp-compat-take'.
* test/lisp/net/tramp-tests.el (tramp-test34-connection-local-variables)
(tramp-test34-explicit-shell-file-name): Don't let-bind
`connection-local-profile-alist' and `connection-local-criteria-alist'.
---
doc/misc/tramp.texi | 39 +++++++++++++++++++++++++++++----------
lisp/net/tramp-container.el | 18 +++++++++---------
lisp/net/tramp.el | 3 ++-
test/lisp/net/tramp-tests.el | 6 ++----
4 files changed, 42 insertions(+), 24 deletions(-)
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 01f46865a39..27145c3cca1 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -142,6 +142,7 @@ on the remote host.
* Ssh setup:: Ssh setup hints.
* FUSE setup:: @acronym{FUSE} setup hints.
* Android shell setup:: Android shell setup hints.
+* Kubernetes setup:: Kubernetes setup hints.
* Auto-save File Lock and Backup::
Auto-save, File Lock and Backup.
* Keeping files encrypted:: Protect remote files by encryption.
@@ -700,6 +701,7 @@ on the remote host.
* Ssh setup:: Ssh setup hints.
* FUSE setup:: @acronym{FUSE} setup hints.
* Android shell setup:: Android shell setup hints.
+* Kubernetes setup:: Kubernetes setup hints.
* Auto-save File Lock and Backup::
Auto-save, File Lock and Backup.
* Keeping files encrypted:: Protect remote files by encryption.
@@ -921,16 +923,10 @@ if desired.
@cindex method @option{kubernetes}
@cindex @option{kubernetes} method
-Integration for containers in Kubernetes pods. The host name is a pod
-name returned by @samp{kubectl get pods}, or
-@samp{@var{container}.@var{pod}} if an explicit container name shall
-be used. Otherwise, the first container in a pod is used.
-
-@vindex tramp-kubernetes-context
-@vindex tramp-kubernetes-namespace
-If another Kubernetes context or namespace shall be used, configure
-the user options @code{tramp-kubernetes-context} and
-@code{tramp-kubernetes-namespace}.
+Integration for containers in Kubernetes pods. The host name is
+@samp{@var{pod}}, or @samp{@var{container}.@var{pod}} if an
+explicit container name shall be used. Otherwise, the first container
+in a pod is used.
This method does not support user names.
@@ -3122,6 +3118,29 @@ Open a remote connection with the more concise command
@kbd{C-x C-f
@end itemize
+@node Kubernetes setup
+@section Kubernetes setup hints
+
+With the @option{kubernetes} method, containers in Kubernetes pods can
+be accessed. The host name is a pod name returned by @samp{kubectl
+get pods}, or @samp{@var{container}.@var{pod}} if an explicit
+container name shall be used. Otherwise, the first container in a pod
+is used.
+
+Sometimes, asynchronous processes for a host without a dedicated
+container name show a warning like @samp{Defaulted container
+"container1" out of: container1, container2}. This can be mitigated
+by setting the pod annotation
+@samp{kubectl.kubernetes.io/default-container} to a proper value
+(@samp{container1} in this example).
+
+@vindex tramp-kubernetes-context
+@vindex tramp-kubernetes-namespace
+@value{tramp} uses the default Kubernetes context and namespace. If
+another context or namespace shall be used, configure the user options
+@code{tramp-kubernetes-context} and @code{tramp-kubernetes-namespace}.
+
+
@node Auto-save File Lock and Backup
@section Auto-save, File Lock and Backup configuration
@cindex auto-save
diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el
index 6e8d28a3016..7f8d4473ad7 100644
--- a/lisp/net/tramp-container.el
+++ b/lisp/net/tramp-container.el
@@ -256,7 +256,7 @@ Obey `tramp-kubernetes-context'"
;;;###tramp-autoload
(defun tramp-kubernetes--context-namespace (vec)
- "The kubectl options for context and namespace."
+ "The kubectl options for context and namespace as string."
(mapconcat
#'identity
`(,(when-let ((context (tramp-kubernetes--current-context vec)))
@@ -404,7 +404,7 @@ see its function help for a description of the format."
;; Default connection-local variables for Tramp.
- (defconst tramp-container-connection-local-default-kubernetes-variables
+ (defconst tramp-kubernetes-connection-local-default-variables
'((tramp-config-check . tramp-kubernetes--current-context-data)
;; This variable will be eval'ed in `tramp-expand-args'.
(tramp-extra-expand-args
@@ -414,24 +414,24 @@ see its function help for a description of the format."
"Default connection-local variables for remote kubernetes connections.")
(connection-local-set-profile-variables
- 'tramp-container-connection-local-default-kubernetes-profile
- tramp-container-connection-local-default-kubernetes-variables)
+ 'tramp-kubernetes-connection-local-default-profile
+ tramp-kubernetes-connection-local-default-variables)
(connection-local-set-profiles
`(:application tramp :protocol ,tramp-kubernetes-method)
- 'tramp-container-connection-local-default-kubernetes-profile)
+ 'tramp-kubernetes-connection-local-default-profile)
- (defconst tramp-container-connection-local-default-flatpak-variables
+ (defconst tramp-flatpak-connection-local-default-variables
`((tramp-remote-path . ,(cons "/app/bin" tramp-remote-path)))
"Default connection-local variables for remote flatpak connections.")
(connection-local-set-profile-variables
- 'tramp-container-connection-local-default-flatpak-profile
- tramp-container-connection-local-default-flatpak-variables)
+ 'tramp-flatpak-connection-local-default-profile
+ tramp-flatpak-connection-local-default-variables)
(connection-local-set-profiles
`(:application tramp :protocol ,tramp-flatpak-method)
- 'tramp-container-connection-local-default-flatpak-profile))
+ 'tramp-flatpak-connection-local-default-profile))
(add-hook 'tramp-unload-hook
(lambda ()
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index cbd4e1611eb..f64abbcf06e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4968,7 +4968,8 @@ a connection-local variable."
;; Merge both spec lists. Remove duplicate entries.
(while spec-list
(unless (member (car spec-list) extra-spec-list)
- (setq extra-spec-list (append (take 2 spec-list) extra-spec-list)))
+ (setq extra-spec-list
+ (append (tramp-compat-take 2 spec-list) extra-spec-list)))
(setq spec-list (cddr spec-list)))
(setq spec (apply #'format-spec-make extra-spec-list))
;; Expand format spec.
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a2e57e468c1..45bcf23f790 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -6136,8 +6136,7 @@ INPUT, if non-nil, is a string sent to the process."
(inhibit-message t)
kill-buffer-query-functions
(clpa connection-local-profile-alist)
- (clca connection-local-criteria-alist)
- connection-local-profile-alist connection-local-criteria-alist)
+ (clca connection-local-criteria-alist))
(unwind-protect
(progn
(make-directory tmp-name1)
@@ -6219,8 +6218,7 @@ INPUT, if non-nil, is a string sent to the process."
(let ((default-directory ert-remote-temporary-file-directory)
explicit-shell-file-name kill-buffer-query-functions
(clpa connection-local-profile-alist)
- (clca connection-local-criteria-alist)
- connection-local-profile-alist connection-local-criteria-alist)
+ (clca connection-local-criteria-alist))
(unwind-protect
(progn
(connection-local-set-profile-variables
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master c5d61023130: Adapt Tramp's kubernetes integration,
Michael Albinus <=