From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.devel Subject: Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method Date: Mon, 24 Oct 2022 17:39:11 +0300 Message-ID: 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="21379"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 24 16:54:43 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 1omyqg-0005ML-J0 for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Oct 2022 16:54:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omybq-0006KL-Ai; Mon, 24 Oct 2022 10:39:22 -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 1omybn-0006K4-4s for emacs-devel@gnu.org; Mon, 24 Oct 2022 10:39:19 -0400 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omybl-0008Lg-Dn for emacs-devel@gnu.org; Mon, 24 Oct 2022 10:39:18 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 987253200987; Mon, 24 Oct 2022 10:39:14 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 24 Oct 2022 10:39:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1666622354; x=1666708754; bh=wAeWxyE3K6 6R2vBcmp4i6vVGGvwfn9JmdecMdI60OmM=; b=MJFKM82qdbYcSQiyCnLWX8HLLS 8GpIn2rRneBvtakx5/q0i1iqEoLYYAQHCtnVDh7DMzr04D2dpEUaFANKrAu1tMno RAO7obRPTWVzMvWM5v4qLr6bhip8xC3q4qLJYyNm563E9f14sS+qtWvuXE5wFKJq csxEFHbEf3qwLM7D6nLgbX0EQsDwzKbP3u4ZH69xSXjvV8rClqy/R82beHPRSU4t DA8eaS+HzfR7IVaSHCuGr9zEzzHJt6dqbu4SQlJm5FF+eP0aipA2B5CevpoiZw3D 1Yhob30YI9SrJYbmEwI0D7NZjYEFCdwgJfI8Kvt/wmA5uk+ME+9426dMmchQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1666622354; x=1666708754; bh=wAeWxyE3K66R2vBcmp4i6vVGGvwf n9JmdecMdI60OmM=; b=tYkUfqPNW+nfeap9i/kjZcZUQIGA1FpCAN4WqNJGHwQC 8Mwon+LhxCEzyhLLgeOW8BAKtIszOauXzIrHMheqzWBPiHiiAy9WAXZUWlZjnSRZ ySKxKTj++D/4FtQ5zaQV6rAP5Ay5D+htAhbzUTQyG9p16FRL1ugaMxylV+21j7NW FgTb+9shgexXsrrZB16gI5YbRz9Vez50yFJ4nCBCQGBiwzE5gEgyW2QqJRP+msXy Z3Qev1D/qrGPGwAxFaFN6c0o8f4rLlY2DDJ15k4pwdm1T2mVYvPefGAal7W/6idg 9iU3kW6Bs1yc6lHkaUrucUJlSsVlUsCVl8C5zohafw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrgedtgedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffgffkfggtgesthdtredttdertdenucfhrhhomhephfhilhhi phhpucfiuhhnsghinhcuoehfghhunhgsihhnsehfrghsthhmrghilhdrfhhmqeenucggtf frrghtthgvrhhnpeffhfejveeiieeiudetgfehffelieevfeeffedtkeelheeludefueeu udehveeiffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehfghhunhgsihhnsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: id48c41f1:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Oct 2022 10:39:13 -0400 (EDT) In-Reply-To: <87tu3w6v74.fsf@gmx.de> (Michael Albinus's message of "Sat, 22 Oct 2022 11:53:19 +0200") Mail-Followup-To: Michael Albinus , emacs-devel@gnu.org Received-SPF: pass client-ip=64.147.123.19; envelope-from=fgunbin@fastmail.fm; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-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:298369 Archived-At: Hi Michael, On 22/10/2022 11:53 +0200, Michael Albinus wrote: > Filipp Gunbin 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=}. 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