mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Lens app source code (#119)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
936cbd53d4
commit
1d0815abd2
797 files changed
+73714
-215
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import * as yaml from "js-yaml"
|
||||
|
||||
// Convert access token and expiry from arrays into strings
|
||||
export function migration(store: any) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user