diff --git a/src/common/cluster-store.ts b/src/common/cluster-store.ts index 74dc7e29af..2eae7da6a8 100644 --- a/src/common/cluster-store.ts +++ b/src/common/cluster-store.ts @@ -11,7 +11,7 @@ import { appEventBus } from "./event-bus"; import { dumpConfigYaml } from "./kube-helpers"; import { saveToAppFiles } from "./utils/saveToAppFiles"; import { KubeConfig } from "@kubernetes/client-node"; -import { broadcastMessage, handleRequest, requestMain, subscribeToBroadcast, unsubscribeAllFromBroadcast, InvalidKubeconfigChannel } from "./ipc"; +import { handleRequest, requestMain, subscribeToBroadcast, unsubscribeAllFromBroadcast } from "./ipc"; import _ from "lodash"; import move from "array-move"; import type { WorkspaceId } from "./workspace-store"; @@ -372,9 +372,3 @@ export function getHostedClusterId() { export function getHostedCluster(): Cluster { return clusterStore.getById(getHostedClusterId()); } - -export function reportDeadClusters() { - clusterStore.clustersList.filter(cluster => cluster.isDead).forEach(cluster => { - broadcastMessage(InvalidKubeconfigChannel, cluster.id); - }); -} diff --git a/src/main/cluster.ts b/src/main/cluster.ts index 8e7bc507e2..847300df66 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -4,7 +4,7 @@ import type { IMetricsReqParams } from "../renderer/api/endpoints/metrics.api"; import type { WorkspaceId } from "../common/workspace-store"; import { action, comparer, computed, observable, reaction, toJS, when } from "mobx"; import { apiKubePrefix } from "../common/vars"; -import { broadcastMessage } from "../common/ipc"; +import { broadcastMessage, InvalidKubeconfigChannel } from "../common/ipc"; import { ContextHandler } from "./context-handler"; import { AuthorizationV1Api, CoreV1Api, KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node"; import { Kubectl } from "./kubectl"; @@ -267,6 +267,7 @@ export class Cluster implements ClusterModel, ClusterState { } catch(err) { logger.error(err); logger.error(`[CLUSTER] Failed to load kubeconfig for the cluster '${this.name || this.contextName}' (context: ${this.contextName}, kubeconfig: ${this.kubeConfigPath}).`); + broadcastMessage(InvalidKubeconfigChannel, model. id); this.isDead = true; } } diff --git a/src/main/index.ts b/src/main/index.ts index 05cefd9461..c98595fa35 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -15,7 +15,7 @@ import { getFreePort } from "./port"; import { mangleProxyEnv } from "./proxy-env"; import { registerFileProtocol } from "../common/register-protocol"; import logger from "./logger"; -import { clusterStore, reportDeadClusters } from "../common/cluster-store"; +import { clusterStore } from "../common/cluster-store"; import { userStore } from "../common/user-store"; import { workspaceStore } from "../common/workspace-store"; import { appEventBus } from "../common/event-bus"; @@ -128,10 +128,7 @@ app.on("ready", async () => { logger.info("🖥️ Starting WindowManager"); windowManager = WindowManager.getInstance(proxyPort); - windowManager.whenLoaded.then(() => { - startUpdateChecking(); - reportDeadClusters(); - }); + windowManager.whenLoaded.then(() => startUpdateChecking()); logger.info("🧩 Initializing extensions");