mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Catch Cluster create error in cluster-manager
- Only warn if the file is missing. The file must have disapeared betweeen kubeconfig-sync detecting it and cluster-manager performing the addCluster call - For all other errors log an error Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
eef5dd5f9c
commit
e71ee75581
@ -161,6 +161,7 @@ export class ClusterManager extends Singleton {
|
|||||||
const cluster = this.store.getById(entity.metadata.uid);
|
const cluster = this.store.getById(entity.metadata.uid);
|
||||||
|
|
||||||
if (!cluster) {
|
if (!cluster) {
|
||||||
|
try {
|
||||||
this.store.addCluster({
|
this.store.addCluster({
|
||||||
id: entity.metadata.uid,
|
id: entity.metadata.uid,
|
||||||
preferences: {
|
preferences: {
|
||||||
@ -169,6 +170,13 @@ export class ClusterManager extends Singleton {
|
|||||||
kubeConfigPath: entity.spec.kubeconfigPath,
|
kubeConfigPath: entity.spec.kubeconfigPath,
|
||||||
contextName: entity.spec.kubeconfigContext
|
contextName: entity.spec.kubeconfigContext
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === "ENOENT" && error.path === entity.spec.kubeconfigPath) {
|
||||||
|
console.warn("[CLUSTER-MANGER]: kubeconfig file disappeared", { path: entity.spec.kubeconfigPath });
|
||||||
|
} else {
|
||||||
|
console.error(`[CLUSTER-MANAGER]: failed to add cluster: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster.kubeConfigPath = entity.spec.kubeconfigPath;
|
cluster.kubeConfigPath = entity.spec.kubeconfigPath;
|
||||||
cluster.contextName = entity.spec.kubeconfigContext;
|
cluster.contextName = entity.spec.kubeconfigContext;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user