mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
set cwd when spawning kube auth proxy (#7069)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
9ca8dc86fd
commit
d3c4816e4b
@ -12,6 +12,7 @@ import loggerInjectable from "../../common/logger.injectable";
|
|||||||
import waitUntilPortIsUsedInjectable from "./wait-until-port-is-used/wait-until-port-is-used.injectable";
|
import waitUntilPortIsUsedInjectable from "./wait-until-port-is-used/wait-until-port-is-used.injectable";
|
||||||
import lensK8sProxyPathInjectable from "./lens-k8s-proxy-path.injectable";
|
import lensK8sProxyPathInjectable from "./lens-k8s-proxy-path.injectable";
|
||||||
import getPortFromStreamInjectable from "../utils/get-port-from-stream.injectable";
|
import getPortFromStreamInjectable from "../utils/get-port-from-stream.injectable";
|
||||||
|
import getDirnameOfPathInjectable from "../../common/path/get-dirname.injectable";
|
||||||
|
|
||||||
export type CreateKubeAuthProxy = (cluster: Cluster, environmentVariables: NodeJS.ProcessEnv) => KubeAuthProxy;
|
export type CreateKubeAuthProxy = (cluster: Cluster, environmentVariables: NodeJS.ProcessEnv) => KubeAuthProxy;
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ const createKubeAuthProxyInjectable = getInjectable({
|
|||||||
logger: di.inject(loggerInjectable),
|
logger: di.inject(loggerInjectable),
|
||||||
waitUntilPortIsUsed: di.inject(waitUntilPortIsUsedInjectable),
|
waitUntilPortIsUsed: di.inject(waitUntilPortIsUsedInjectable),
|
||||||
getPortFromStream: di.inject(getPortFromStreamInjectable),
|
getPortFromStream: di.inject(getPortFromStreamInjectable),
|
||||||
|
dirname: di.inject(getDirnameOfPathInjectable),
|
||||||
};
|
};
|
||||||
|
|
||||||
return (cluster: Cluster, environmentVariables: NodeJS.ProcessEnv) => {
|
return (cluster: Cluster, environmentVariables: NodeJS.ProcessEnv) => {
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { TypedRegEx } from "typed-regex";
|
|||||||
import type { Spawn } from "../child-process/spawn.injectable";
|
import type { Spawn } from "../child-process/spawn.injectable";
|
||||||
import type { Logger } from "../../common/logger";
|
import type { Logger } from "../../common/logger";
|
||||||
import type { WaitUntilPortIsUsed } from "./wait-until-port-is-used/wait-until-port-is-used.injectable";
|
import type { WaitUntilPortIsUsed } from "./wait-until-port-is-used/wait-until-port-is-used.injectable";
|
||||||
|
import type { GetDirnameOfPath } from "../../common/path/get-dirname.injectable";
|
||||||
|
|
||||||
const startingServeMatcher = "starting to serve on (?<address>.+)";
|
const startingServeMatcher = "starting to serve on (?<address>.+)";
|
||||||
const startingServeRegex = Object.assign(TypedRegEx(startingServeMatcher, "i"), {
|
const startingServeRegex = Object.assign(TypedRegEx(startingServeMatcher, "i"), {
|
||||||
@ -27,6 +28,7 @@ export interface KubeAuthProxyDependencies {
|
|||||||
spawn: Spawn;
|
spawn: Spawn;
|
||||||
waitUntilPortIsUsed: WaitUntilPortIsUsed;
|
waitUntilPortIsUsed: WaitUntilPortIsUsed;
|
||||||
getPortFromStream: GetPortFromStream;
|
getPortFromStream: GetPortFromStream;
|
||||||
|
dirname: GetDirnameOfPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class KubeAuthProxy {
|
export class KubeAuthProxy {
|
||||||
@ -69,6 +71,7 @@ export class KubeAuthProxy {
|
|||||||
PROXY_KEY: cert.private,
|
PROXY_KEY: cert.private,
|
||||||
PROXY_CERT: cert.cert,
|
PROXY_CERT: cert.cert,
|
||||||
},
|
},
|
||||||
|
cwd: this.dependencies.dirname(this.cluster.kubeConfigPath),
|
||||||
});
|
});
|
||||||
this.proxyProcess.on("error", (error) => {
|
this.proxyProcess.on("error", (error) => {
|
||||||
this.cluster.broadcastConnectUpdate(error.message, "error");
|
this.cluster.broadcastConnectUpdate(error.message, "error");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user