diff --git a/src/main/__test__/lens-proxy.test.ts b/src/main/__test__/lens-proxy.test.ts index a80d983dec..20af162f17 100644 --- a/src/main/__test__/lens-proxy.test.ts +++ b/src/main/__test__/lens-proxy.test.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ -import { isLongRunningRequest } from "../lens-proxy"; +import { isLongRunningRequest } from "../lens-proxy/lens-proxy"; describe("isLongRunningRequest", () => { it("returns true on watches", () => { diff --git a/src/main/k8s-request.injectable.ts b/src/main/k8s-request.injectable.ts index 96a61a721b..a556cf62f2 100644 --- a/src/main/k8s-request.injectable.ts +++ b/src/main/k8s-request.injectable.ts @@ -7,7 +7,7 @@ import request from "request-promise-native"; import { apiKubePrefix } from "../common/vars"; import type { Cluster } from "../common/cluster/cluster"; import { getInjectable } from "@ogre-tools/injectable"; -import lensProxyPortInjectable from "./lens-proxy-port.injectable"; +import lensProxyPortInjectable from "./lens-proxy/lens-proxy-port.injectable"; export type K8sRequest = (cluster: Cluster, path: string, options?: RequestPromiseOptions) => Promise; diff --git a/src/main/kubeconfig-manager/create-kubeconfig-manager.injectable.ts b/src/main/kubeconfig-manager/create-kubeconfig-manager.injectable.ts index 3933917769..f46fd2fa8f 100644 --- a/src/main/kubeconfig-manager/create-kubeconfig-manager.injectable.ts +++ b/src/main/kubeconfig-manager/create-kubeconfig-manager.injectable.ts @@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable"; import type { Cluster } from "../../common/cluster/cluster"; import directoryForTempInjectable from "../../common/app-paths/directory-for-temp/directory-for-temp.injectable"; import { KubeconfigManager } from "./kubeconfig-manager"; -import lensProxyPortInjectable from "../lens-proxy-port.injectable"; +import lensProxyPortInjectable from "../lens-proxy/lens-proxy-port.injectable"; export interface KubeConfigManagerInstantiationParameter { cluster: Cluster; diff --git a/src/main/lens-proxy-port.injectable.ts b/src/main/lens-proxy/lens-proxy-port.injectable.ts similarity index 100% rename from src/main/lens-proxy-port.injectable.ts rename to src/main/lens-proxy/lens-proxy-port.injectable.ts diff --git a/src/main/lens-proxy.injectable.ts b/src/main/lens-proxy/lens-proxy.injectable.ts similarity index 89% rename from src/main/lens-proxy.injectable.ts rename to src/main/lens-proxy/lens-proxy.injectable.ts index f16ae39508..34cb327339 100644 --- a/src/main/lens-proxy.injectable.ts +++ b/src/main/lens-proxy/lens-proxy.injectable.ts @@ -5,9 +5,9 @@ import { getInjectable } from "@ogre-tools/injectable"; import { LensProxy } from "./lens-proxy"; import { kubeApiUpgradeRequest } from "./proxy-functions"; -import routerInjectable from "./router/router.injectable"; +import routerInjectable from "../router/router.injectable"; import httpProxy from "http-proxy"; -import clusterManagerInjectable from "./cluster-manager.injectable"; +import clusterManagerInjectable from "../cluster-manager.injectable"; import shellApiRequestInjectable from "./proxy-functions/shell-api-request/shell-api-request.injectable"; import lensProxyPortInjectable from "./lens-proxy-port.injectable"; diff --git a/src/main/lens-proxy.ts b/src/main/lens-proxy/lens-proxy.ts similarity index 95% rename from src/main/lens-proxy.ts rename to src/main/lens-proxy/lens-proxy.ts index 82da830ac4..99d7e819b7 100644 --- a/src/main/lens-proxy.ts +++ b/src/main/lens-proxy/lens-proxy.ts @@ -7,14 +7,14 @@ import net from "net"; import type http from "http"; import spdy from "spdy"; import type httpProxy from "http-proxy"; -import { apiPrefix, apiKubePrefix } from "../common/vars"; -import type { Router } from "./router/router"; -import type { ContextHandler } from "./context-handler/context-handler"; -import logger from "./logger"; -import type { Cluster } from "../common/cluster/cluster"; +import { apiPrefix, apiKubePrefix } from "../../common/vars"; +import type { Router } from "../router/router"; +import type { ContextHandler } from "../context-handler/context-handler"; +import logger from "../logger"; +import type { Cluster } from "../../common/cluster/cluster"; import type { ProxyApiRequestArgs } from "./proxy-functions"; -import { appEventBus } from "../common/app-event-bus/event-bus"; -import { getBoolean } from "./utils/parse-query"; +import { appEventBus } from "../../common/app-event-bus/event-bus"; +import { getBoolean } from "../utils/parse-query"; type GetClusterForRequest = (req: http.IncomingMessage) => Cluster | null; diff --git a/src/main/proxy-functions/index.ts b/src/main/lens-proxy/proxy-functions/index.ts similarity index 100% rename from src/main/proxy-functions/index.ts rename to src/main/lens-proxy/proxy-functions/index.ts diff --git a/src/main/proxy-functions/kube-api-upgrade-request.ts b/src/main/lens-proxy/proxy-functions/kube-api-upgrade-request.ts similarity index 94% rename from src/main/proxy-functions/kube-api-upgrade-request.ts rename to src/main/lens-proxy/proxy-functions/kube-api-upgrade-request.ts index 899d22164e..f45af1a256 100644 --- a/src/main/proxy-functions/kube-api-upgrade-request.ts +++ b/src/main/lens-proxy/proxy-functions/kube-api-upgrade-request.ts @@ -6,7 +6,7 @@ import { chunk } from "lodash"; import tls from "tls"; import url from "url"; -import { apiKubePrefix } from "../../common/vars"; +import { apiKubePrefix } from "../../../common/vars"; import type { ProxyApiRequestArgs } from "./types"; const skipRawHeaders = new Set(["Host", "Authorization"]); @@ -16,8 +16,8 @@ export async function kubeApiUpgradeRequest({ req, socket, head, cluster }: Prox const proxyCa = await cluster.contextHandler.resolveAuthProxyCa(); const apiUrl = url.parse(cluster.apiUrl); const pUrl = url.parse(proxyUrl); - const connectOpts = { - port: parseInt(pUrl.port), + const connectOpts = { + port: parseInt(pUrl.port), host: pUrl.hostname, ca: proxyCa, }; diff --git a/src/main/proxy-functions/shell-api-request/shell-api-request.injectable.ts b/src/main/lens-proxy/proxy-functions/shell-api-request/shell-api-request.injectable.ts similarity index 81% rename from src/main/proxy-functions/shell-api-request/shell-api-request.injectable.ts rename to src/main/lens-proxy/proxy-functions/shell-api-request/shell-api-request.injectable.ts index d4703a16c7..b491ab5456 100644 --- a/src/main/proxy-functions/shell-api-request/shell-api-request.injectable.ts +++ b/src/main/lens-proxy/proxy-functions/shell-api-request/shell-api-request.injectable.ts @@ -4,9 +4,9 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { shellApiRequest } from "./shell-api-request"; -import createShellSessionInjectable from "../../shell-session/create-shell-session.injectable"; +import createShellSessionInjectable from "../../../shell-session/create-shell-session.injectable"; import shellRequestAuthenticatorInjectable from "./shell-request-authenticator/shell-request-authenticator.injectable"; -import clusterManagerInjectable from "../../cluster-manager.injectable"; +import clusterManagerInjectable from "../../../cluster-manager.injectable"; const shellApiRequestInjectable = getInjectable({ id: "shell-api-request", diff --git a/src/main/proxy-functions/shell-api-request/shell-api-request.ts b/src/main/lens-proxy/proxy-functions/shell-api-request/shell-api-request.ts similarity index 85% rename from src/main/proxy-functions/shell-api-request/shell-api-request.ts rename to src/main/lens-proxy/proxy-functions/shell-api-request/shell-api-request.ts index 467955a14f..9de07b58f6 100644 --- a/src/main/proxy-functions/shell-api-request/shell-api-request.ts +++ b/src/main/lens-proxy/proxy-functions/shell-api-request/shell-api-request.ts @@ -3,14 +3,14 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ -import logger from "../../logger"; +import logger from "../../../logger"; import type WebSocket from "ws"; import { Server as WebSocketServer } from "ws"; import type { ProxyApiRequestArgs } from "../types"; -import type { ClusterManager } from "../../cluster-manager"; +import type { ClusterManager } from "../../../cluster-manager"; import URLParse from "url-parse"; -import type { Cluster } from "../../../common/cluster/cluster"; -import type { ClusterId } from "../../../common/cluster-types"; +import type { Cluster } from "../../../../common/cluster/cluster"; +import type { ClusterId } from "../../../../common/cluster-types"; interface Dependencies { authenticateRequest: (clusterId: ClusterId, tabId: string, shellToken: string) => boolean; diff --git a/src/main/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.injectable.ts b/src/main/lens-proxy/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.injectable.ts similarity index 100% rename from src/main/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.injectable.ts rename to src/main/lens-proxy/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.injectable.ts diff --git a/src/main/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.ts b/src/main/lens-proxy/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.ts similarity index 89% rename from src/main/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.ts rename to src/main/lens-proxy/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.ts index bafd073c14..e16977f7b8 100644 --- a/src/main/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.ts +++ b/src/main/lens-proxy/proxy-functions/shell-api-request/shell-request-authenticator/shell-request-authenticator.ts @@ -2,9 +2,9 @@ * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ -import { getOrInsertMap } from "../../../../common/utils"; -import type { ClusterId } from "../../../../common/cluster-types"; -import { ipcMainHandle } from "../../../../common/ipc"; +import { getOrInsertMap } from "../../../../../common/utils"; +import type { ClusterId } from "../../../../../common/cluster-types"; +import { ipcMainHandle } from "../../../../../common/ipc"; import crypto from "crypto"; import { promisify } from "util"; diff --git a/src/main/proxy-functions/types.ts b/src/main/lens-proxy/proxy-functions/types.ts similarity index 83% rename from src/main/proxy-functions/types.ts rename to src/main/lens-proxy/proxy-functions/types.ts index 4d7e3a684e..8ff2e889eb 100644 --- a/src/main/proxy-functions/types.ts +++ b/src/main/lens-proxy/proxy-functions/types.ts @@ -5,7 +5,7 @@ import type http from "http"; import type net from "net"; -import type { Cluster } from "../../common/cluster/cluster"; +import type { Cluster } from "../../../common/cluster/cluster"; export interface ProxyApiRequestArgs { req: http.IncomingMessage; diff --git a/src/main/start-main-application/lens-window/application-window/application-window.injectable.ts b/src/main/start-main-application/lens-window/application-window/application-window.injectable.ts index fbf428ffb4..50c7d5abfb 100644 --- a/src/main/start-main-application/lens-window/application-window/application-window.injectable.ts +++ b/src/main/start-main-application/lens-window/application-window/application-window.injectable.ts @@ -5,7 +5,7 @@ import { getInjectable } from "@ogre-tools/injectable"; import { lensWindowInjectionToken } from "./lens-window-injection-token"; import createLensWindowInjectable from "./create-lens-window.injectable"; -import lensProxyPortInjectable from "../../../lens-proxy-port.injectable"; +import lensProxyPortInjectable from "../../../lens-proxy/lens-proxy-port.injectable"; import isMacInjectable from "../../../../common/vars/is-mac.injectable"; import appNameInjectable from "../../../app-paths/app-name/app-name.injectable"; import appEventBusInjectable from "../../../../common/app-event-bus/app-event-bus.injectable"; diff --git a/src/main/start-main-application/runnables/setup-lens-proxy.injectable.ts b/src/main/start-main-application/runnables/setup-lens-proxy.injectable.ts index 64d4e62604..9e3546fbd8 100644 --- a/src/main/start-main-application/runnables/setup-lens-proxy.injectable.ts +++ b/src/main/start-main-application/runnables/setup-lens-proxy.injectable.ts @@ -5,9 +5,9 @@ import { getInjectable } from "@ogre-tools/injectable"; import { getAppVersion, getAppVersionFromProxyServer } from "../../../common/utils"; import exitAppInjectable from "../../electron-app/features/exit-app.injectable"; -import lensProxyInjectable from "../../lens-proxy.injectable"; +import lensProxyInjectable from "../../lens-proxy/lens-proxy.injectable"; import loggerInjectable from "../../../common/logger.injectable"; -import lensProxyPortInjectable from "../../lens-proxy-port.injectable"; +import lensProxyPortInjectable from "../../lens-proxy/lens-proxy-port.injectable"; import isWindowsInjectable from "../../../common/vars/is-windows.injectable"; import showErrorPopupInjectable from "../../electron-app/features/show-error-popup.injectable"; import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/before-application-is-loading-injection-token";