Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 96eefdb

Browse files
committed
fix(plugins/plugin-kubectl): new kubectl direct logic does not properly handle ECONNREFUSED
Fixes #6476
1 parent 85b849c commit 96eefdb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

plugins/plugin-kubectl/src/controller/client/direct/errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { CodedError, isCodedError, is404, REPL } from '@kui-shell/core'
17+
import { CodedError, isCodedError, REPL } from '@kui-shell/core'
1818

1919
import URLFormatter from './url'
2020
import { Status, isStatus } from '../../../lib/model/resource'
@@ -92,7 +92,7 @@ export default async function handleErrors(
9292
})
9393
)
9494

95-
if (withErrors.every(is404)) {
95+
if (withErrors.every(isCodedError)) {
9696
// we didn't get a single good response back
9797
const error: CodedError = new Error(withErrors.map(_ => _.message).join('\n'))
9898
error.code = withErrors[0].code

plugins/plugin-kubectl/src/controller/client/direct/get.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ export default async function getDirect(args: Arguments<KubeOptions>, _kind: Pro
6464
}
6565
}, undefined)
6666

67-
if (args.execOptions.type === ExecType.TopLevel && metaTable.rows.length === 0 && !isWatchRequest(args)) {
67+
if (
68+
args.execOptions.type === ExecType.TopLevel &&
69+
metaTable &&
70+
metaTable.rows.length === 0 &&
71+
!isWatchRequest(args)
72+
) {
6873
return `No resources found in **${await getNamespace(args)}** namespace.`
6974
} else {
7075
try {

0 commit comments

Comments
 (0)