mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Consolidate LensProxy related stuff to directory
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
c2ffdc27b9
commit
b703b43745
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* 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", () => {
|
describe("isLongRunningRequest", () => {
|
||||||
it("returns true on watches", () => {
|
it("returns true on watches", () => {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import request from "request-promise-native";
|
|||||||
import { apiKubePrefix } from "../common/vars";
|
import { apiKubePrefix } from "../common/vars";
|
||||||
import type { Cluster } from "../common/cluster/cluster";
|
import type { Cluster } from "../common/cluster/cluster";
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
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<any>;
|
export type K8sRequest = (cluster: Cluster, path: string, options?: RequestPromiseOptions) => Promise<any>;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import type { Cluster } from "../../common/cluster/cluster";
|
import type { Cluster } from "../../common/cluster/cluster";
|
||||||
import directoryForTempInjectable from "../../common/app-paths/directory-for-temp/directory-for-temp.injectable";
|
import directoryForTempInjectable from "../../common/app-paths/directory-for-temp/directory-for-temp.injectable";
|
||||||
import { KubeconfigManager } from "./kubeconfig-manager";
|
import { KubeconfigManager } from "./kubeconfig-manager";
|
||||||
import lensProxyPortInjectable from "../lens-proxy-port.injectable";
|
import lensProxyPortInjectable from "../lens-proxy/lens-proxy-port.injectable";
|
||||||
|
|
||||||
export interface KubeConfigManagerInstantiationParameter {
|
export interface KubeConfigManagerInstantiationParameter {
|
||||||
cluster: Cluster;
|
cluster: Cluster;
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { LensProxy } from "./lens-proxy";
|
import { LensProxy } from "./lens-proxy";
|
||||||
import { kubeApiUpgradeRequest } from "./proxy-functions";
|
import { kubeApiUpgradeRequest } from "./proxy-functions";
|
||||||
import routerInjectable from "./router/router.injectable";
|
import routerInjectable from "../router/router.injectable";
|
||||||
import httpProxy from "http-proxy";
|
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 shellApiRequestInjectable from "./proxy-functions/shell-api-request/shell-api-request.injectable";
|
||||||
import lensProxyPortInjectable from "./lens-proxy-port.injectable";
|
import lensProxyPortInjectable from "./lens-proxy-port.injectable";
|
||||||
|
|
||||||
@ -7,14 +7,14 @@ import net from "net";
|
|||||||
import type http from "http";
|
import type http from "http";
|
||||||
import spdy from "spdy";
|
import spdy from "spdy";
|
||||||
import type httpProxy from "http-proxy";
|
import type httpProxy from "http-proxy";
|
||||||
import { apiPrefix, apiKubePrefix } from "../common/vars";
|
import { apiPrefix, apiKubePrefix } from "../../common/vars";
|
||||||
import type { Router } from "./router/router";
|
import type { Router } from "../router/router";
|
||||||
import type { ContextHandler } from "./context-handler/context-handler";
|
import type { ContextHandler } from "../context-handler/context-handler";
|
||||||
import logger from "./logger";
|
import logger from "../logger";
|
||||||
import type { Cluster } from "../common/cluster/cluster";
|
import type { Cluster } from "../../common/cluster/cluster";
|
||||||
import type { ProxyApiRequestArgs } from "./proxy-functions";
|
import type { ProxyApiRequestArgs } from "./proxy-functions";
|
||||||
import { appEventBus } from "../common/app-event-bus/event-bus";
|
import { appEventBus } from "../../common/app-event-bus/event-bus";
|
||||||
import { getBoolean } from "./utils/parse-query";
|
import { getBoolean } from "../utils/parse-query";
|
||||||
|
|
||||||
type GetClusterForRequest = (req: http.IncomingMessage) => Cluster | null;
|
type GetClusterForRequest = (req: http.IncomingMessage) => Cluster | null;
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
import { chunk } from "lodash";
|
import { chunk } from "lodash";
|
||||||
import tls from "tls";
|
import tls from "tls";
|
||||||
import url from "url";
|
import url from "url";
|
||||||
import { apiKubePrefix } from "../../common/vars";
|
import { apiKubePrefix } from "../../../common/vars";
|
||||||
import type { ProxyApiRequestArgs } from "./types";
|
import type { ProxyApiRequestArgs } from "./types";
|
||||||
|
|
||||||
const skipRawHeaders = new Set(["Host", "Authorization"]);
|
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 proxyCa = await cluster.contextHandler.resolveAuthProxyCa();
|
||||||
const apiUrl = url.parse(cluster.apiUrl);
|
const apiUrl = url.parse(cluster.apiUrl);
|
||||||
const pUrl = url.parse(proxyUrl);
|
const pUrl = url.parse(proxyUrl);
|
||||||
const connectOpts = {
|
const connectOpts = {
|
||||||
port: parseInt(pUrl.port),
|
port: parseInt(pUrl.port),
|
||||||
host: pUrl.hostname,
|
host: pUrl.hostname,
|
||||||
ca: proxyCa,
|
ca: proxyCa,
|
||||||
};
|
};
|
||||||
@ -4,9 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { shellApiRequest } from "./shell-api-request";
|
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 shellRequestAuthenticatorInjectable from "./shell-request-authenticator/shell-request-authenticator.injectable";
|
||||||
import clusterManagerInjectable from "../../cluster-manager.injectable";
|
import clusterManagerInjectable from "../../../cluster-manager.injectable";
|
||||||
|
|
||||||
const shellApiRequestInjectable = getInjectable({
|
const shellApiRequestInjectable = getInjectable({
|
||||||
id: "shell-api-request",
|
id: "shell-api-request",
|
||||||
@ -3,14 +3,14 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* 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 type WebSocket from "ws";
|
||||||
import { Server as WebSocketServer } from "ws";
|
import { Server as WebSocketServer } from "ws";
|
||||||
import type { ProxyApiRequestArgs } from "../types";
|
import type { ProxyApiRequestArgs } from "../types";
|
||||||
import type { ClusterManager } from "../../cluster-manager";
|
import type { ClusterManager } from "../../../cluster-manager";
|
||||||
import URLParse from "url-parse";
|
import URLParse from "url-parse";
|
||||||
import type { Cluster } from "../../../common/cluster/cluster";
|
import type { Cluster } from "../../../../common/cluster/cluster";
|
||||||
import type { ClusterId } from "../../../common/cluster-types";
|
import type { ClusterId } from "../../../../common/cluster-types";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
authenticateRequest: (clusterId: ClusterId, tabId: string, shellToken: string) => boolean;
|
authenticateRequest: (clusterId: ClusterId, tabId: string, shellToken: string) => boolean;
|
||||||
@ -2,9 +2,9 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getOrInsertMap } from "../../../../common/utils";
|
import { getOrInsertMap } from "../../../../../common/utils";
|
||||||
import type { ClusterId } from "../../../../common/cluster-types";
|
import type { ClusterId } from "../../../../../common/cluster-types";
|
||||||
import { ipcMainHandle } from "../../../../common/ipc";
|
import { ipcMainHandle } from "../../../../../common/ipc";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
|
|
||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import type http from "http";
|
import type http from "http";
|
||||||
import type net from "net";
|
import type net from "net";
|
||||||
import type { Cluster } from "../../common/cluster/cluster";
|
import type { Cluster } from "../../../common/cluster/cluster";
|
||||||
|
|
||||||
export interface ProxyApiRequestArgs {
|
export interface ProxyApiRequestArgs {
|
||||||
req: http.IncomingMessage;
|
req: http.IncomingMessage;
|
||||||
@ -5,7 +5,7 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { lensWindowInjectionToken } from "./lens-window-injection-token";
|
import { lensWindowInjectionToken } from "./lens-window-injection-token";
|
||||||
import createLensWindowInjectable from "./create-lens-window.injectable";
|
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 isMacInjectable from "../../../../common/vars/is-mac.injectable";
|
||||||
import appNameInjectable from "../../../app-paths/app-name/app-name.injectable";
|
import appNameInjectable from "../../../app-paths/app-name/app-name.injectable";
|
||||||
import appEventBusInjectable from "../../../../common/app-event-bus/app-event-bus.injectable";
|
import appEventBusInjectable from "../../../../common/app-event-bus/app-event-bus.injectable";
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { getAppVersion, getAppVersionFromProxyServer } from "../../../common/utils";
|
import { getAppVersion, getAppVersionFromProxyServer } from "../../../common/utils";
|
||||||
import exitAppInjectable from "../../electron-app/features/exit-app.injectable";
|
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 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 isWindowsInjectable from "../../../common/vars/is-windows.injectable";
|
||||||
import showErrorPopupInjectable from "../../electron-app/features/show-error-popup.injectable";
|
import showErrorPopupInjectable from "../../electron-app/features/show-error-popup.injectable";
|
||||||
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/before-application-is-loading-injection-token";
|
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/before-application-is-loading-injection-token";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user