all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Filipp Gunbin <fgunbin@fastmail.fm>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method
Date: Mon, 24 Oct 2022 17:39:11 +0300	[thread overview]
Message-ID: <m2o7u1cmls.fsf@fastmail.fm> (raw)
In-Reply-To: <87tu3w6v74.fsf@gmx.de> (Michael Albinus's message of "Sat, 22 Oct 2022 11:53:19 +0200")

Hi Michael,

On 22/10/2022 11:53 +0200, Michael Albinus wrote:

> Filipp Gunbin <fgunbin@fastmail.fm> writes:
>
> Hi Filipp,
>
>> +@samp{kubectl get pods} returns pods in the current context and
>> +namespace.  Current namespace can be changed with @samp{kubectl config
>> +set-context --current --namespace=<name>}.  After invoking this or
>> +other command which modifies Kubernetes environment outside of Emacs,
>> +call @code{tramp-cleanup-all-connections} to reset Tramp cache data.
>
> Can we automate this? I mean, when pod data are cached, and Tramp
> detects a changed namespace, the cached data should be flushed?
>
> Tramp does something similar with other connection methods, for example
> it checks "uname -sr" on remote hosts, and caches the result. Whenever a
> new connection to a host is established, Tramp calls again "uname -sr",
> and compares with the cached value. If the values differ, all cached
> data for this connection are flushed.
>
> Is there a similar way to retieve (and cache) the current context and
> namespace for pods?

(I've actually wrote a message to emacs-devel about this, but then
decided it's just simpler to advise resetting cache, and didn't send the
message; maybe I should have asked first)

AFAIU, the general way would be to call "kubectl config view -o json",
then calculate checksum of the output and cache it.  This would catch
any change in context (namespace it just one case of many).

However, there're two things to consider here:

- "config view" command is not instantaneous: on my machine it's about
  100ms, and calling it on each (say) host completion would be annoying.

- Your example with uname is different in that if uname output changed,
  it means that the host environment changed, perhaps without local user
  knowing about it.  With kubectl, it's the local user which did some
  change (locally), and I see no problem in requiring her/him to reset
  Tramp cache after that.

Filipp



  reply	other threads:[~2022-10-24 14:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166637666472.14803.2269230477358344016@vcs2.savannah.gnu.org>
     [not found] ` <20221021182424.F0E84C00B0F@vcs2.savannah.gnu.org>
2022-10-22  9:53   ` master 55eabe96c9: ; Improve manual for Tramp kubernetes method Michael Albinus
2022-10-24 14:39     ` Filipp Gunbin [this message]
2022-10-24 15:07       ` Michael Albinus
2022-10-24 15:33         ` Michael Albinus
2022-10-24 18:54           ` Michael Albinus
2022-10-24 23:42             ` Filipp Gunbin
2022-10-25 14:50               ` Michael Albinus
2022-10-25 15:43                 ` Yuri Khan
2022-10-25 15:48                   ` Robert Pluim
2022-10-25 16:02                     ` Yuri Khan
2022-10-25 16:45                       ` Michael Albinus
2022-10-25 17:29             ` Filipp Gunbin
2022-10-25 17:48               ` Michael Albinus
2022-10-25 18:41                 ` Filipp Gunbin
2022-10-25 20:14                 ` Filipp Gunbin
2022-10-26 12:01                   ` Michael Albinus
2022-10-24 20:41         ` Filipp Gunbin
2022-10-24 22:49           ` Filipp Gunbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2o7u1cmls.fsf@fastmail.fm \
    --to=fgunbin@fastmail.fm \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.