diff --git a/src/main/cluster.ts b/src/main/cluster.ts index a0f5d7a7a2..ae5c0da675 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -144,18 +144,22 @@ export class Cluster implements ClusterModel { await this.refreshAllowedResources() this.isAdmin = await this.isClusterAdmin() this.ready = true - this.kubeCtl = new Kubectl(this.version) - this.kubeCtl.ensureKubectl() // download kubectl in background, so it's not blocking dashboard + this.ensureKubectl() } this.activated = true return this.pushState(); } + protected async ensureKubectl() { + this.kubeCtl = new Kubectl(this.version) + return this.kubeCtl.ensureKubectl() // download kubectl in background, so it's not blocking dashboard + } + @action async reconnect() { logger.info(`[CLUSTER]: reconnect`, this.getMeta()); - this.contextHandler.stopServer(); - await this.contextHandler.ensureServer(); + this.contextHandler?.stopServer(); + await this.contextHandler?.ensureServer(); this.disconnected = false; } @@ -163,7 +167,7 @@ export class Cluster implements ClusterModel { disconnect() { logger.info(`[CLUSTER]: disconnect`, this.getMeta()); this.unbindEvents(); - this.contextHandler.stopServer(); + this.contextHandler?.stopServer(); this.disconnected = true; this.online = false; this.accessible = false;