From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method Date: Mon, 24 Oct 2022 17:07:38 +0200 Message-ID: <87a65l6z0l.fsf@gmx.de> References: <166637666472.14803.2269230477358344016@vcs2.savannah.gnu.org> <20221021182424.F0E84C00B0F@vcs2.savannah.gnu.org> <87tu3w6v74.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13504"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 24 18:23:42 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1on0Eo-0003GF-C7 for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Oct 2022 18:23:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omz3O-0004RI-Bz; Mon, 24 Oct 2022 11:07:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omz3M-0004R7-Tf for emacs-devel@gnu.org; Mon, 24 Oct 2022 11:07:48 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omz3G-00057J-S5 for emacs-devel@gnu.org; Mon, 24 Oct 2022 11:07:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666624059; bh=1jP6qUcdKfHWrPWUXKSTDkNCg3gYpKmrvlF5lyVJqeM=; h=X-UI-Sender-Class:From:To:Subject:In-Reply-To:References:Date; b=AZYRItacThWiyTIis0GZtRyo4DYnE2fQcIFlFMzGRLMPWCA4rADaokM6u65TXZ75O lo3iV00xzWXGqyhrG22zgVOm1c0MbHc077TAZ6/lOxJzs701xscXZOsbchc6gEZYj/ RSQjVkYrAon/YdLcaelKzHDYfyMBXVRaPLdDzkPo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.148.109]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MJVDW-1oXe3X2QjA-00Jo7T for ; Mon, 24 Oct 2022 17:07:39 +0200 In-Reply-To: (Filipp Gunbin's message of "Mon, 24 Oct 2022 17:39:11 +0300") X-Provags-ID: V03:K1:A8vqVFBL+nED3//fVMHvuaLm/JKbZ++rlE6FsAzTuIJtzZ8p8tB 6LUCtaSYjQGZoL6ZepCoQTUpKAwepC+D25excO+T7loOZsRCZfFer9x9X1duP17UkdKpQWH lFv1h6E95A/aRiE0GyZ/kBg6Gf4l8Nw9YhfB42IFzpYEs41rfDDTvmwlcl1W6j4HfBiXfdT MKrqLbL1VcHQeNPhU/e2w== X-UI-Out-Filterresults: notjunk:1;V03:K0:dO+REFPE2Dk=:/n2AH0Q7W6o9Wj/Y6zBKnV If1UuvBxEnyv1sNXng4W70qyy6Y6L/8p5MAX07W1H7tCxY04KXN6u8IVl7DfxchxtTk6kf/rQ wI8ice4aZkpFsOyjJwmRFb23Ad4zJ822b4/he9G1sltxcVlX7MElbiDrdAZ9xJ+iSUa6uPQpg NKV3cJkU5bTSbpyW7+q7nsPUwaMfXC7A7slXe87JCx3TaEGUil6koZDT6W3XEIFtwDSzSYc3m mUf87SQ4hUHQIEeg0pl9u2ex5E0BMqdpDWbjUbYLdN1vmRTp0i9Eo5RD0Kqy/rJqJ74TGP3k1 JdnGLrpu9HD8fQex0kErOBL2zs7RuCZ8oa9YGTz9EUd8CKGR/t+936MbnwTtNWzIvJoxTgO5T Z1Qec9qZO8hpls0Q9qP9qYPPy5W/eW2+TEQqXd4KRl81ec8Ant1T89ZGRC9Zwsy5jJ4ZCyLCI Wbs1s/vKle0LwZzF03VHfjJ/jmMg7TxOprBYjZ7heQAmHUFmnjkbWppd2rhIfDFt/HR3UqkMR 0GMHS5n7Q98awzPYMDz6u3d4QiT+21e5QjIblhsk8CzCAMFsmAo5DeJAV/hCQS2vvCaGux4S/ Uvc9j6afvusksboYM0ifvewVpTdF4wWw8Ht6FVEbkb9il9KKve2XaKCNwGt082S9DHTiYc1f8 shukFTycDx7Yes+XxRPPbBlAylNYGXjpW3WdOW2LuxaECWNmj9B9+ulk0HbQrFP42+FLy9nqk 5aSGp/5vZqzs21nB7oR/hVn21SeKBlLrdue/LRiSicCpCiBLbk2e8M1YWsXQRYNlHYnq13Xx Received-SPF: pass client-ip=212.227.15.19; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298382 Archived-At: Filipp Gunbin writes: > Hi Michael, Hi Filipp, >> 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) No problem that's what code review is good for :-) > 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). Yep, but I would recommend "kubectl config view --context=$(kubectl config current-context) -o json". We don't need the information about other context. > 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. I don't recommend it for hostname completion. I recommend it for opening a connection; the cleanup shall happen in tramp-maybe-open-connection via a hook. If a user changes the context while there is an active connection in Tramp, she will be lost. But this isn't an Emacs/Tramp specific situation, so we don't need to care or document it. > - 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. Sure, but if we can this automate, it doesn't hurt. People tend to forget to follow such recommendations for cleanup, and we will be blamed with error reports about invalid cache entries then. I'm just working on a patch, will show it to you for confirmation prior commitment. > Filipp Best regards, Michael.