mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix pod shell error if no access to nodes (#275)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
ac552087d5
commit
07e2653f80
@ -411,6 +411,13 @@ export class Pod extends WorkloadKubeObject {
|
||||
getNodeName() {
|
||||
return this.spec?.nodeName
|
||||
}
|
||||
|
||||
getSelectedNodeOs() {
|
||||
if (!this.spec.nodeSelector) return
|
||||
if (!this.spec.nodeSelector["kubernetes.io/os"]) return
|
||||
|
||||
return this.spec.nodeSelector["kubernetes.io/os"]
|
||||
}
|
||||
}
|
||||
|
||||
export const podsApi = new PodsApi({
|
||||
|
||||
@ -21,9 +21,8 @@ export class PodMenu extends React.Component<Props> {
|
||||
hideDetails();
|
||||
const { object: pod } = this.props
|
||||
const containerParam = container ? `-c ${container}` : ""
|
||||
const node = await nodesApi.get({name: pod.getNodeName()})
|
||||
let command = `kubectl exec -i -t -n ${pod.getNs()} ${pod.getName()} ${containerParam} "--"`
|
||||
if (node.getOperatingSystem() == "windows") {
|
||||
if (pod.getSelectedNodeOs() === "windows") {
|
||||
command = `${command} powershell`
|
||||
} else {
|
||||
command = `${command} sh -c "clear; (bash || ash || sh)"`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user