mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Changed to use ClusterModel when adding clusters
This commit is contained in:
parent
ba5a860fe7
commit
1f36e06cc8
@ -127,6 +127,8 @@ export class Cluster implements ClusterModel {
|
|||||||
async activate(init = false) {
|
async activate(init = false) {
|
||||||
const clusterActivatedAt = new Date();
|
const clusterActivatedAt = new Date();
|
||||||
logger.info(`[CLUSTER]: activate@${clusterActivatedAt.toString()}`, this.getMeta());
|
logger.info(`[CLUSTER]: activate@${clusterActivatedAt.toString()}`, this.getMeta());
|
||||||
|
logger.info(`[CLUSTER]: activate eventDisposers length: ${this.eventDisposers.length}`);
|
||||||
|
logger.info(`[CLUSTER]: activate eventDisposers: ${this.eventDisposers}`);
|
||||||
await this.whenInitialized;
|
await this.whenInitialized;
|
||||||
logger.info("[CLUSTER]: activate now initialized")
|
logger.info("[CLUSTER]: activate now initialized")
|
||||||
logger.info(`[CLUSTER]: activate eventDisposers length: ${this.eventDisposers.length}`);
|
logger.info(`[CLUSTER]: activate eventDisposers length: ${this.eventDisposers.length}`);
|
||||||
|
|||||||
@ -138,7 +138,8 @@ export class DECCManager {
|
|||||||
//console.log(`Generated kubeconfig: ${YAML.stringify(jsConfig)}`)
|
//console.log(`Generated kubeconfig: ${YAML.stringify(jsConfig)}`)
|
||||||
|
|
||||||
let newClusters: ClusterModel[] = [];
|
let newClusters: ClusterModel[] = [];
|
||||||
let newCluster = new Cluster({
|
|
||||||
|
let newCluster: ClusterModel = {
|
||||||
id: deccCluster.metadata.uid,
|
id: deccCluster.metadata.uid,
|
||||||
contextName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
|
contextName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
|
||||||
preferences: {
|
preferences: {
|
||||||
@ -147,11 +148,28 @@ export class DECCManager {
|
|||||||
},
|
},
|
||||||
kubeConfigPath: ClusterStore.embedCustomKubeConfig(deccCluster.metadata.uid, YAML.stringify(jsConfig)),
|
kubeConfigPath: ClusterStore.embedCustomKubeConfig(deccCluster.metadata.uid, YAML.stringify(jsConfig)),
|
||||||
workspace: workspace.id,
|
workspace: workspace.id,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// let newCluster = new Cluster({
|
||||||
|
// id: deccCluster.metadata.uid,
|
||||||
|
// contextName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
|
||||||
|
// preferences: {
|
||||||
|
// clusterName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
|
||||||
|
// httpsProxy: undefined,
|
||||||
|
// },
|
||||||
|
// kubeConfigPath: ClusterStore.embedCustomKubeConfig(deccCluster.metadata.uid, YAML.stringify(jsConfig)),
|
||||||
|
// workspace: workspace.id,
|
||||||
|
// });
|
||||||
|
|
||||||
newClusters.push(newCluster);
|
newClusters.push(newCluster);
|
||||||
clusterStore.addCluster(...newClusters);
|
clusterStore.addCluster(...newClusters);
|
||||||
logger.info(`addLensClusterToDECCWorkspace: Created Cluster Name: ${username}@${clusterPrefix}-${deccCluster.metadata.name}, Cluster UCP Dashboard URL: ${ucpDashboard}`)
|
|
||||||
|
let createdCluster = clusterStore.getById(newCluster.id);
|
||||||
|
createdCluster.pushState();
|
||||||
|
clusterStore.load();
|
||||||
|
|
||||||
|
// clusterStore.setActive(newCluster.id);
|
||||||
|
logger.info(`addLensClusterToDECCWorkspace: Created Cluster Name: ${createdCluster.preferences.clusterName}, Cluster UCP Dashboard URL: ${ucpDashboard}`);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user