Open johnhamelink opened 1 year ago
Hi @johnhamelink , Thank you for sharing this! I was not aware of these changes at all. This is actually a trickier change than first anticipated because we also have to keep things working for people running versions anterior to 29:
tramp-kubernetes-program
if definedtramp-kubernetes-method
isn't defined<kubectl> config use/set-context <context>
is global? as in it will change the context for the whole machine, which is something that kubel doesn't do at all today and could have un-intended consequencesI'm also still on 28 and not sure when I will upgrade/find time to work on this.
We can probably do some smart logic and try to default/fallback to tramp-kubernetes-program if defined similarly we should keep the old TRAMP method if tramp-kubernetes-method isn't defined
Sounds good!
I think that
config use/set-context is global?
That's right. I wonder if instead we could supply environment variables to the underlying kubectl process?
Another issue is that according to the docs, "The first container in a pod is used", which is rather limiting for Kubel's use-case. Similar tools like k9s allow you to select the pod - often the first pod is actually istio-proxy
or a similar "sidecar" pod which is less interesting.
This works for me
(with-eval-after-load 'tramp
(require 'tramp-container)
(when-let* ((method (thread-last tramp-methods
(seq-find #'(lambda (it) (pcase it (`("kubernetes" . ,_) t))))))
(updated (pcase method (`(,_ . ,rest) `("kubectl" . ,rest)))))
(add-to-list 'tramp-methods updated)))
It inserts kubectl
method with the same config of kubernetes
method defined in tramp-container
Hope it helps.
FYI it's now possible to define a container ID along with a pod in Emacs master: https://github.com/emacs-mirror/emacs/blob/master/lisp/net/tramp-container.el#L47
It seems that the namespace and context can be defined now too: https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS#L439
Hi there,
I'm running Emacs from master branch. Emacs 29 comes with support for Kubernetes, Podman and Docker as TRAMP "inline methods" (see here).
tramp-kubernetes-program
as the default path forkubectl
for Emacs 29+kubectl
TRAMP method, and towards using the officialkubernetes
method instead.tramp-kubernetes-context
andtramp-kubernetes-namespace
(https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS#L439).