1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Switch to defaulting to kubectl

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-09-13 15:07:23 -04:00
parent 9dc89a9a3a
commit 8d77ada7d3
4 changed files with 14 additions and 7 deletions

View File

@ -45,9 +45,12 @@ export interface NodeMenuProps extends Renderer.Component.KubeObjectMenuProps<No
export function NodeMenu(props: NodeMenuProps) { export function NodeMenu(props: NodeMenuProps) {
const { object: node, toolbar } = props; const { object: node, toolbar } = props;
if (!node) return null; if (!node) {
return null;
}
const nodeName = node.getName(); const nodeName = node.getName();
const kubectlPath = JSON.stringify(App.Preferences.getKubectlPath()); // this call escapes spaces and quotes const kubectlPath = App.Preferences.getKubectlPath() || "kubectl";
const sendToTerminal = (command: string) => { const sendToTerminal = (command: string) => {
terminalStore.sendCommand(command, { terminalStore.sendCommand(command, {

View File

@ -49,8 +49,9 @@ export class PodAttachMenu extends React.Component<PodAttachMenuProps> {
async attachToPod(container?: string) { async attachToPod(container?: string) {
const { object: pod } = this.props; const { object: pod } = this.props;
const kubectlPath = App.Preferences.getKubectlPath() || "kubectl";
const commandParts = [ const commandParts = [
JSON.stringify(App.Preferences.getKubectlPath()), // this call escapes spaces and quotes kubectlPath,
"attach", "attach",
"-i", "-i",
"-t", "-t",

View File

@ -49,8 +49,9 @@ export class PodShellMenu extends React.Component<PodShellMenuProps> {
async execShell(container?: string) { async execShell(container?: string) {
const { object: pod } = this.props; const { object: pod } = this.props;
const kubectlPath = App.Preferences.getKubectlPath() || "kubectl";
const commandParts = [ const commandParts = [
JSON.stringify(App.Preferences.getKubectlPath()), // this call escapes spaces and quotes kubectlPath,
"exec", "exec",
"-i", "-i",
"-t", "-t",

View File

@ -20,8 +20,10 @@
*/ */
import { UserStore } from "../../common/user-store"; import { UserStore } from "../../common/user-store";
import { bundledKubectlPath } from "../../main/kubectl";
export function getKubectlPath(): string { /**
return UserStore.getInstance().kubectlBinariesPath || bundledKubectlPath(); * Get the configured kubectl binaries path.
*/
export function getKubectlPath(): string | undefined {
return UserStore.getInstance().kubectlBinariesPath;
} }