mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleanup 'Cluster' to remove environment specific details (#6951)
- requestNamespaceListPermissions is infallable so no need to have the extra try/catch - Refactor isMetricHidden method away from Cluster - Refactor shouldShowResource out of Cluster - Refactor isInLocalKubeconfig out of Cluster - Remove depecrated and unused workspace from Cluster - Refactor out kubectl as a dependency of Cluster - Remove from cluster getter used only once - Split out ClusterConnection from Cluster - Also split out KubeAuthProxyServer from ContextHandler - Rename ContextHandler to PrometheusHandler - Cleanup onNetworkOffline/Online impls within ClusterManager - Remove annotations from ClusterConnection - Remove mobx annotations from Cluster - Rename loadConfigFromFileInjectable - Remove all uses of dead createClusterInjectionToken - Fix type errors related to broadcastConnectionUpdate Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
e6d6d1d8f7
commit
ad9bafe2a5
133 files changed
+2544
-1961
No files matched your search
@@ -111,6 +111,8 @@ export interface ShellSessionDependencies {
|
||||
readonly userShellSetting: IComputedValue<string>;
|
||||
readonly appName: string;
|
||||
readonly buildVersion: InitializableState<string>;
|
||||
readonly proxyKubeconfigPath: string;
|
||||
readonly directoryContainingKubectl: string;
|
||||
computeShellEnvironment: ComputeShellEnvironment;
|
||||
spawnPty: SpawnPty;
|
||||
emitAppEvent: EmitAppEvent;
|
||||
@@ -147,8 +149,6 @@ export abstract class ShellSession {
|
||||
}
|
||||
|
||||
protected running = false;
|
||||
protected readonly kubectlBinDirP: Promise<string>;
|
||||
protected readonly kubeconfigPathP: Promise<string>;
|
||||
protected readonly terminalId: string;
|
||||
protected readonly kubectl: Kubectl;
|
||||
protected readonly websocket: WebSocket;
|
||||
@@ -179,8 +179,6 @@ export abstract class ShellSession {
|
||||
this.kubectl = kubectl;
|
||||
this.websocket = websocket;
|
||||
this.cluster = cluster;
|
||||
this.kubeconfigPathP = this.cluster.getProxyKubeconfigPath();
|
||||
this.kubectlBinDirP = this.kubectl.binDir();
|
||||
this.terminalId = `${cluster.id}:${terminalId}`;
|
||||
}
|
||||
|
||||
@@ -297,7 +295,7 @@ export abstract class ShellSession {
|
||||
code !== WebSocketCloseEvent.AbnormalClosure
|
||||
&& code !== WebSocketCloseEvent.GoingAway
|
||||
)
|
||||
|| this.cluster.disconnected
|
||||
|| this.cluster.disconnected.get()
|
||||
);
|
||||
|
||||
if (stopShellSession) {
|
||||
@@ -350,7 +348,7 @@ export abstract class ShellSession {
|
||||
})();
|
||||
|
||||
const env = clearKubeconfigEnvVars(JSON.parse(JSON.stringify(rawEnv)));
|
||||
const pathStr = [await this.kubectlBinDirP, ...this.getPathEntries(), env.PATH].join(path.delimiter);
|
||||
const pathStr = [this.dependencies.directoryContainingKubectl, ...this.getPathEntries(), env.PATH].join(path.delimiter);
|
||||
|
||||
delete env.DEBUG; // don't pass DEBUG into shells
|
||||
|
||||
@@ -373,12 +371,12 @@ export abstract class ShellSession {
|
||||
|
||||
if (path.basename(env.PTYSHELL) === "zsh") {
|
||||
env.OLD_ZDOTDIR = env.ZDOTDIR || env.HOME;
|
||||
env.ZDOTDIR = await this.kubectlBinDirP;
|
||||
env.ZDOTDIR = this.dependencies.directoryContainingKubectl;
|
||||
env.DISABLE_AUTO_UPDATE = "true";
|
||||
}
|
||||
|
||||
env.PTYPID = process.pid.toString();
|
||||
env.KUBECONFIG = await this.kubeconfigPathP;
|
||||
env.KUBECONFIG = this.dependencies.proxyKubeconfigPath;
|
||||
env.TERM_PROGRAM = this.dependencies.appName;
|
||||
env.TERM_PROGRAM_VERSION = this.dependencies.buildVersion.get();
|
||||
|
||||
|
||||
Reference in new issue
Block a user