Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09-beta 47 lines 2.0 kB view raw
1From b69fee70154a861637c82e98e18be01bbb96423b Mon Sep 17 00:00:00 2001 2From: Florian Klink <flokli@flokli.de> 3Date: Wed, 12 Jun 2019 17:03:09 +0200 4Subject: [PATCH] kubeconfig: don't store absolute path to gcloud binary 5MIME-Version: 1.0 6Content-Type: text/plain; charset=UTF-8 7Content-Transfer-Encoding: 8bit 8 9The `gcloud beta container clusters get-credentials $cluster \ 10--region $region --project $project` 11command can be used to write kubectl config files. 12 13In that file, normally the absolute path to the `gcloud` binary is 14stored. 15 16This is a bad idea in NixOS. We might eventually garbage-collect that 17specific gcloud binary - and in general, would expect a nix-shell 18provided gcloud to be used. 19 20In its current state, token renewal would just start to break with the 21following error message: 22 23Unable to connect to the server: error executing access token command "/nix/store/…/gcloud config config-helper --format=json": err=fork/exec /nix/store/…/gcloud: no such file or directory output= stderr= 24 25Avoid this by storing just `gcloud` inside `cmd-path`, which causes 26kubectl to lookup the gcloud command from $PATH, which is more likely to 27keep working. 28--- 29 lib/googlecloudsdk/api_lib/container/kubeconfig.py | 2 +- 30 1 file changed, 1 insertion(+), 1 deletion(-) 31 32diff --git a/lib/googlecloudsdk/api_lib/container/kubeconfig.py b/lib/googlecloudsdk/api_lib/container/kubeconfig.py 33index 4330988d6..37424b841 100644 34--- a/lib/googlecloudsdk/api_lib/container/kubeconfig.py 35+++ b/lib/googlecloudsdk/api_lib/container/kubeconfig.py 36@@ -255,7 +255,7 @@ def _AuthProvider(name='gcp'): 37 raise Error(SDK_BIN_PATH_NOT_FOUND) 38 cfg = { 39 # Command for gcloud credential helper 40- 'cmd-path': os.path.join(sdk_bin_path, bin_name), 41+ 'cmd-path': bin_name, 42 # Args for gcloud credential helper 43 'cmd-args': 'config config-helper --format=json', 44 # JSONpath to the field that is the raw access token 45-- 462.21.0 47