1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Merge branch 'fix/ignore-clusters-with-corrupted-kubeconfig' into display-invalid-kubeconfig-warnings

This commit is contained in:
Lauri Nevala 2021-03-01 11:58:41 +02:00
commit 76cf124586
3 changed files with 3 additions and 6 deletions

View File

@ -323,7 +323,7 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
} else {
cluster = new Cluster(clusterModel);
if (!cluster.isManaged && !cluster.isDead) {
if (!cluster.isManaged && cluster.apiUrl) {
cluster.enabled = true;
}
}
@ -337,7 +337,7 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
}
});
this.activeCluster = newClusters.has(activeCluster) && newClusters.get(activeCluster).enabled ? activeCluster : null;
this.activeCluster = newClusters.get(activeCluster)?.enabled ? activeCluster : null;
this.clusters.replace(newClusters);
this.removedClusters.replace(removedClusters);
}

View File

@ -157,8 +157,7 @@ export function getNodeWarningConditions(node: V1Node) {
}
/**
* Validates Context, User and Cluster sructs in given kubeconfig. Additionally this will validate
* the command passed to the exec substructure.
* Checks if `config` has valid `Context`, `User`, `Cluster`, and `exec` fields (if present when required)
*/
export function validateKubeConfig (config: KubeConfig, contextName: string, validationOpts: KubeConfigValidationOpts = {}) {
// we only receive a single context, cluster & user object here so lets validate them as this

View File

@ -77,7 +77,6 @@ export class Cluster implements ClusterModel, ClusterState {
* If extension sets this it needs to also mark cluster as enabled on activate (or when added to a store)
*/
public ownerRef: string;
public isDead = false;
protected kubeconfigManager: KubeconfigManager;
protected eventDisposers: Function[] = [];
protected activated = false;
@ -268,7 +267,6 @@ export class Cluster implements ClusterModel, ClusterState {
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;
}
}