mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
e810eab39f
commit
b7974827d2
786 files changed
+14567
-24066
No files matched your search
@@ -0,0 +1,17 @@
|
||||
/* Early store format had the kubeconfig directly under context name, this moves
|
||||
it under the kubeConfig key */
|
||||
|
||||
import { isTestEnv } from "../../common/vars";
|
||||
|
||||
export function migration(store: any) {
|
||||
if(!isTestEnv) {
|
||||
console.log("CLUSTER STORE, MIGRATION: 2.0.0-beta.2");
|
||||
}
|
||||
for (const value of store) {
|
||||
const contextName = value[0];
|
||||
// Looping all the keys gives out the store internal stuff too...
|
||||
if(contextName === "__internal__" || value[1].hasOwnProperty('kubeConfig')) continue;
|
||||
|
||||
store.set(contextName, { kubeConfig: value[1] });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Cleans up a store that had the state related data stored
|
||||
import { isTestEnv } from "../../common/vars";
|
||||
|
||||
export function migration(store: any) {
|
||||
if (!isTestEnv) {
|
||||
console.log("CLUSTER STORE, MIGRATION: 2.4.1");
|
||||
}
|
||||
for (const value of store) {
|
||||
const contextName = value[0];
|
||||
if (contextName === "__internal__") continue;
|
||||
const cluster = value[1];
|
||||
|
||||
store.set(contextName, { kubeConfig: cluster.kubeConfig, icon: cluster.icon || null, preferences: cluster.preferences || {} });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Move cluster icon from root to preferences
|
||||
import { isTestEnv } from "../../common/vars";
|
||||
|
||||
export function migration(store: any) {
|
||||
if(!isTestEnv) {
|
||||
console.log("CLUSTER STORE, MIGRATION: 2.6.0-beta.2");
|
||||
}
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if(clusterKey === "__internal__") continue
|
||||
const cluster = value[1];
|
||||
if(!cluster.preferences) cluster.preferences = {};
|
||||
if(cluster.icon) {
|
||||
cluster.preferences.icon = cluster.icon;
|
||||
delete(cluster["icon"]);
|
||||
}
|
||||
store.set(clusterKey, { contextName: clusterKey, kubeConfig: value[1].kubeConfig, preferences: value[1].preferences });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import * as yaml from "js-yaml"
|
||||
import { isTestEnv } from "../../common/vars";
|
||||
|
||||
// Convert access token and expiry from arrays into strings
|
||||
export function migration(store: any) {
|
||||
if(!isTestEnv) {
|
||||
console.log("CLUSTER STORE, MIGRATION: 2.6.0-beta.3");
|
||||
}
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if(clusterKey === "__internal__") continue
|
||||
const cluster = value[1];
|
||||
if(!cluster.kubeConfig) continue
|
||||
const kubeConfig = yaml.safeLoad(cluster.kubeConfig)
|
||||
if(!kubeConfig.hasOwnProperty('users')) continue
|
||||
const userObj = kubeConfig.users[0]
|
||||
if (userObj) {
|
||||
const user = userObj.user
|
||||
if (user["auth-provider"] && user["auth-provider"].config) {
|
||||
const authConfig = user["auth-provider"].config
|
||||
if (authConfig["access-token"]) {
|
||||
authConfig["access-token"] = `${authConfig["access-token"]}`
|
||||
}
|
||||
if (authConfig.expiry) {
|
||||
authConfig.expiry = `${authConfig.expiry}`
|
||||
}
|
||||
console.log(authConfig)
|
||||
user["auth-provider"].config = authConfig
|
||||
kubeConfig.users = [{
|
||||
name: userObj.name,
|
||||
user: user
|
||||
}]
|
||||
cluster.kubeConfig = yaml.safeDump(kubeConfig)
|
||||
store.set(clusterKey, cluster)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Add existing clusters to "default" workspace
|
||||
import { isTestEnv } from "../../common/vars";
|
||||
|
||||
export function migration(store: any) {
|
||||
if(!isTestEnv) {
|
||||
console.log("CLUSTER STORE, MIGRATION: 2.7.0-beta.0");
|
||||
}
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if(clusterKey === "__internal__") continue
|
||||
const cluster = value[1];
|
||||
cluster.workspace = "default"
|
||||
store.set(clusterKey, cluster)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// add id for clusters and store them to array
|
||||
import { v4 as uuid } from "uuid"
|
||||
import { isTestEnv } from "../../common/vars";
|
||||
|
||||
export function migration(store: any) {
|
||||
if(!isTestEnv) {
|
||||
console.log("CLUSTER STORE, MIGRATION: 2.7.0-beta.1");
|
||||
}
|
||||
const clusters: any[] = []
|
||||
for (const value of store) {
|
||||
const clusterKey = value[0];
|
||||
if(clusterKey === "__internal__") continue
|
||||
if(clusterKey === "clusters") continue
|
||||
const cluster = value[1];
|
||||
cluster.id = uuid()
|
||||
if (!cluster.preferences.clusterName) {
|
||||
cluster.preferences.clusterName = clusterKey
|
||||
}
|
||||
clusters.push(cluster)
|
||||
store.delete(clusterKey)
|
||||
}
|
||||
if (clusters.length > 0) {
|
||||
store.set("clusters", clusters)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// Add / reset "lastSeenAppVersion"
|
||||
export function migration(store: any) {
|
||||
store.set("lastSeenAppVersion", "0.0.0");
|
||||
}
|
||||
Reference in new issue
Block a user