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

Commit fe9338f

Browse files
committed
fix(plugins/plugin-kubectl): kubectl get pod/nginx has buggy drilldown
1 parent fb6ad44 commit fe9338f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

plugins/plugin-kubectl/src/lib/view/formatTable.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,15 @@ export const formatTable = async <O extends KubeOptions>(
255255
if (drilldownVerb === 'get') {
256256
const kind =
257257
kindColumnIdx >= 0 ? row[kindColumnIdx].value : nameSplit.length > 1 ? nameSplit[0] : entityTypeFromCommandLine
258-
return kind ? ' ' + kind : ''
258+
259+
// re: slashIdx, see https://github.com/kubernetes-sigs/kui/issues/9068
260+
// e.g. `kubectl get pod/nginx` then user clicks to drill down on the row
261+
const slashIdx = kind ? kind.indexOf('/') : -1
262+
if (slashIdx >= 0) {
263+
return ' ' + kind.slice(0, slashIdx)
264+
} else {
265+
return kind ? ' ' + kind : ''
266+
}
259267
/* } else if (drilldownVerb === 'config') {
260268
return ' use-context'; */
261269
} else if (drilldownVerb === 'krew') {

plugins/plugin-kubectl/src/test/k8s2/get-pod.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ commands.forEach(command => {
275275
}
276276
})
277277

278+
// see https://github.com/kubernetes-sigs/kui/issues/9068
279+
it(`should list pods via '${command} get pod/nginx' then click`, async () => {
280+
try {
281+
await openSidecarByList(this, `${command} get pod/nginx ${inNamespace}`, 'nginx')
282+
} catch (err) {
283+
return Common.oops(this, true)(err)
284+
}
285+
})
286+
278287
// it(`should click on containers sidecar tab and show containers table`, testContainersTab)
279288

280289
// it('should drill down to log when container is clicked', testLogsTabs)

0 commit comments

Comments
 (0)