diff --git a/src/common/k8s-api/kube-json-api.ts b/src/common/k8s-api/kube-json-api.ts index 3776634a47..59c8a7e980 100644 --- a/src/common/k8s-api/kube-json-api.ts +++ b/src/common/k8s-api/kube-json-api.ts @@ -21,7 +21,6 @@ import { JsonApi, JsonApiData, JsonApiError } from "./json-api"; import type { Response } from "node-fetch"; -import type { Cluster } from "../../main/cluster"; import { LensProxy } from "../../main/lens-proxy"; import { apiKubePrefix, isDebugging } from "../vars"; @@ -73,7 +72,7 @@ export interface KubeJsonApiError extends JsonApiError { } export class KubeJsonApi extends JsonApi { - static forCluster(cluster: Cluster): KubeJsonApi { + static forCluster(clusterId: string): KubeJsonApi { const port = LensProxy.getInstance().port; return new this({ @@ -82,7 +81,7 @@ export class KubeJsonApi extends JsonApi { debug: isDebugging, }, { headers: { - "Host": `${cluster.id}.localhost:${port}`, + "Host": `${clusterId}.localhost:${port}`, }, }); } diff --git a/src/extensions/renderer-api/k8s-api.ts b/src/extensions/renderer-api/k8s-api.ts index 4a084e6373..ecae80fb5a 100644 --- a/src/extensions/renderer-api/k8s-api.ts +++ b/src/extensions/renderer-api/k8s-api.ts @@ -55,6 +55,7 @@ export { ClusterRole, clusterRoleApi } from "../../common/k8s-api/endpoints"; export { ClusterRoleBinding, clusterRoleBindingApi } from "../../common/k8s-api/endpoints"; export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints"; export { KubeObjectStatusLevel } from "./kube-object-status"; +export { KubeJsonApi } from "../../common/k8s-api/kube-json-api"; // types export type { ILocalKubeApiConfig, IRemoteKubeApiConfig, IKubeApiCluster } from "../../common/k8s-api/kube-api"; diff --git a/src/main/shell-session/node-shell-session.ts b/src/main/shell-session/node-shell-session.ts index 1f1a6cab03..b865fc411d 100644 --- a/src/main/shell-session/node-shell-session.ts +++ b/src/main/shell-session/node-shell-session.ts @@ -64,7 +64,7 @@ export class NodeShellSession extends ShellSession { const args = ["exec", "-i", "-t", "-n", "kube-system", this.podName, "--"]; const nodeApi = new NodesApi({ objectConstructor: Node, - request: KubeJsonApi.forCluster(this.cluster), + request: KubeJsonApi.forCluster(this.cluster.id), }); const node = await nodeApi.get({ name: this.nodeName }); const nodeOs = node.getOperatingSystem();