mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Log cluster model if adding a cluster fails when syncing from catalog (#4463)
This commit is contained in:
parent
4257fce2f0
commit
80eeffc229
@ -182,22 +182,24 @@ 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) {
|
||||||
|
const model = {
|
||||||
|
id: entity.metadata.uid,
|
||||||
|
kubeConfigPath: entity.spec.kubeconfigPath,
|
||||||
|
contextName: entity.spec.kubeconfigContext,
|
||||||
|
accessibleNamespaces: entity.spec.accessibleNamespaces ?? [],
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/**
|
/**
|
||||||
* Add the bare minimum of data to ClusterStore. And especially no
|
* Add the bare minimum of data to ClusterStore. And especially no
|
||||||
* preferences, as those might be configured by the entity's source
|
* preferences, as those might be configured by the entity's source
|
||||||
*/
|
*/
|
||||||
this.store.addCluster({
|
this.store.addCluster(model);
|
||||||
id: entity.metadata.uid,
|
|
||||||
kubeConfigPath: entity.spec.kubeconfigPath,
|
|
||||||
contextName: entity.spec.kubeconfigContext,
|
|
||||||
accessibleNamespaces: entity.spec.accessibleNamespaces ?? [],
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code === "ENOENT" && error.path === entity.spec.kubeconfigPath) {
|
if (error.code === "ENOENT" && error.path === entity.spec.kubeconfigPath) {
|
||||||
logger.warn(`${logPrefix} kubeconfig file disappeared`, { path: entity.spec.kubeconfigPath });
|
logger.warn(`${logPrefix} kubeconfig file disappeared`, model);
|
||||||
} else {
|
} else {
|
||||||
logger.error(`${logPrefix} failed to add cluster: ${error}`);
|
logger.error(`${logPrefix} failed to add cluster: ${error}`, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user