1
0
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:
Steve Richards 2020-09-24 10:03:19 +01:00
parent ba5a860fe7
commit 1f36e06cc8
2 changed files with 23 additions and 3 deletions

View File

@ -127,6 +127,8 @@ export class Cluster implements ClusterModel {
async activate(init = false) {
const clusterActivatedAt = new Date();
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;
logger.info("[CLUSTER]: activate now initialized")
logger.info(`[CLUSTER]: activate eventDisposers length: ${this.eventDisposers.length}`);

View File

@ -138,7 +138,8 @@ export class DECCManager {
//console.log(`Generated kubeconfig: ${YAML.stringify(jsConfig)}`)
let newClusters: ClusterModel[] = [];
let newCluster = new Cluster({
let newCluster: ClusterModel = {
id: deccCluster.metadata.uid,
contextName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
preferences: {
@ -147,11 +148,28 @@ export class DECCManager {
},
kubeConfigPath: ClusterStore.embedCustomKubeConfig(deccCluster.metadata.uid, YAML.stringify(jsConfig)),
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);
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}`);
};
}