mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix downloading cluster specific kubectl (#5399)
This commit is contained in:
1 parent
ac27077ef9
commit
e1c1e00a2b
22 files changed
+251
-63
No files matched your search
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import path from "path";
|
||||
import bundledBinariesNormalizedArchInjectable from "./bundled-binaries-normalized-arch.injectable";
|
||||
import bundledResourcesDirectoryInjectable from "./bundled-resources-dir.injectable";
|
||||
|
||||
const baseBundeledBinariesDirectoryInjectable = getInjectable({
|
||||
id: "base-bundeled-binaries-directory",
|
||||
instantiate: (di) => path.join(
|
||||
di.inject(bundledResourcesDirectoryInjectable),
|
||||
di.inject(bundledBinariesNormalizedArchInjectable),
|
||||
),
|
||||
});
|
||||
|
||||
export default baseBundeledBinariesDirectoryInjectable;
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
|
||||
const bundledBinariesNormalizedArchInjectable = getInjectable({
|
||||
id: "bundled-binaries-normalized-arch",
|
||||
instantiate: () => {
|
||||
switch (process.arch) {
|
||||
case "arm64":
|
||||
return "arm64";
|
||||
case "x64":
|
||||
case "amd64":
|
||||
return "x64";
|
||||
case "386":
|
||||
case "x32":
|
||||
case "ia32":
|
||||
return "ia32";
|
||||
default:
|
||||
throw new Error(`arch=${process.arch} is unsupported`);
|
||||
}
|
||||
},
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default bundledBinariesNormalizedArchInjectable;
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import path from "path";
|
||||
import isProductionInjectable from "./is-production.injectable";
|
||||
import normalizedPlatformInjectable from "./normalized-platform.injectable";
|
||||
|
||||
const bundledResourcesDirectoryInjectable = getInjectable({
|
||||
id: "bundled-resources-directory",
|
||||
instantiate: (di) => {
|
||||
const isProduction = di.inject(isProductionInjectable);
|
||||
const normalizedPlatform = di.inject(normalizedPlatformInjectable);
|
||||
|
||||
return isProduction
|
||||
? process.resourcesPath
|
||||
: path.join(process.cwd(), "binaries", "client", normalizedPlatform);
|
||||
},
|
||||
});
|
||||
|
||||
export default bundledResourcesDirectoryInjectable;
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
|
||||
const normalizedPlatformInjectable = getInjectable({
|
||||
id: "normalized-platform",
|
||||
instantiate: () => {
|
||||
switch (process.platform) {
|
||||
case "darwin":
|
||||
return "darwin";
|
||||
case "linux":
|
||||
return "linux";
|
||||
case "win32":
|
||||
return "windows";
|
||||
default:
|
||||
throw new Error(`platform=${process.platform} is unsupported`);
|
||||
}
|
||||
},
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default normalizedPlatformInjectable;
|
||||
Reference in new issue
Block a user