mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify add cluster view (#2716)
- Only shows editor, and will save all text to file - Reports some validation errors, but doesn't block the add cluster button - Cleanup kube helpers to facilitate clearer FS interactions Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
07c7653a70
commit
817c8e00db
18 files changed
+343
-395
No files matched your search
@@ -27,7 +27,7 @@ import { app, remote } from "electron";
|
||||
import { migration } from "../migration-wrapper";
|
||||
import fse from "fs-extra";
|
||||
import { ClusterModel, ClusterStore } from "../../common/cluster-store";
|
||||
import { loadConfig } from "../../common/kube-helpers";
|
||||
import { loadConfigFromFileSync } from "../../common/kube-helpers";
|
||||
|
||||
export default migration({
|
||||
version: "3.6.0-beta.1",
|
||||
@@ -46,9 +46,13 @@ export default migration({
|
||||
* migrate kubeconfig
|
||||
*/
|
||||
try {
|
||||
const absPath = ClusterStore.getCustomKubeConfigPath(cluster.id);
|
||||
|
||||
fse.ensureDirSync(path.dirname(absPath));
|
||||
fse.writeFileSync(absPath, cluster.kubeConfig, { encoding: "utf-8", mode: 0o600 });
|
||||
// take the embedded kubeconfig and dump it into a file
|
||||
cluster.kubeConfigPath = ClusterStore.embedCustomKubeConfig(cluster.id, cluster.kubeConfig);
|
||||
cluster.contextName = loadConfig(cluster.kubeConfigPath).getCurrentContext();
|
||||
cluster.kubeConfigPath = absPath;
|
||||
cluster.contextName = loadConfigFromFileSync(cluster.kubeConfigPath).config.getCurrentContext();
|
||||
delete cluster.kubeConfig;
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user