From 277ca9851239b5fdfe96f4ada9c40d711721022f Mon Sep 17 00:00:00 2001 From: Andrei Vinaga Date: Fri, 18 Mar 2022 12:52:12 +0200 Subject: [PATCH 1/2] fix: add some more error logging --- src/utils/kubeclient.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/kubeclient.ts b/src/utils/kubeclient.ts index f0075d0945..020bd32824 100644 --- a/src/utils/kubeclient.ts +++ b/src/utils/kubeclient.ts @@ -118,6 +118,8 @@ export async function getKubeAccess(namespaces: string[], currentContext: string const results = await Promise.all(promises); const hasErrors = results.length && results.every(result => result.exitCode !== 0); if (hasErrors) { + const errors = results.map(res => res.stderr).join(','); + log.error(`get cluster access errors ${errors}`); throw new Error("Couldn't get cluster access for namespaces"); } From ea1ec354b406d6e538f5489db69fe22a9fa8c699 Mon Sep 17 00:00:00 2001 From: Andrei Vinaga Date: Fri, 18 Mar 2022 14:00:19 +0200 Subject: [PATCH 2/2] fix: check for errors when changing contexts --- .../organisms/PageHeader/ClusterSelectionTable.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/PageHeader/ClusterSelectionTable.tsx b/src/components/organisms/PageHeader/ClusterSelectionTable.tsx index 78441fb81d..d58a37163c 100644 --- a/src/components/organisms/PageHeader/ClusterSelectionTable.tsx +++ b/src/components/organisms/PageHeader/ClusterSelectionTable.tsx @@ -158,8 +158,18 @@ export const ClusterSelectionTable: FC = ({setIsClus runCommandInMainThread({ cmd: `kubectl`, args: ['config', 'use-context', clusterName], - }).then(() => { - dispatch(setCurrentContext(clusterName)); + }).then(arg => { + if (arg?.exitCode === 0) { + dispatch(setCurrentContext(clusterName)); + } else { + dispatch( + setAlert({ + title: 'Error changing cluster context', + message: arg.stderr as string, + type: AlertEnum.Error, + }) + ); + } }); };