[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method
From: |
Filipp Gunbin |
Subject: |
Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method |
Date: |
Mon, 24 Oct 2022 17:39:11 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Michael Albinus, 2022/10/22
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method,
Filipp Gunbin <=
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Michael Albinus, 2022/10/24
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Michael Albinus, 2022/10/24
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Michael Albinus, 2022/10/24
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Filipp Gunbin, 2022/10/24
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Michael Albinus, 2022/10/25
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Yuri Khan, 2022/10/25
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Robert Pluim, 2022/10/25
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Yuri Khan, 2022/10/25
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Michael Albinus, 2022/10/25
- Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method, Filipp Gunbin, 2022/10/25