From b68bc0e3b8a7d84f79f803c8e1a2ba781fd695d9 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 25 Nov 2020 15:26:34 +0200 Subject: [PATCH] cleanup Signed-off-by: Jari Kolehmainen --- src/main/cluster.ts | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/main/cluster.ts b/src/main/cluster.ts index ac64183efa..c7749ebe77 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -322,40 +322,6 @@ export class Cluster implements ClusterModel, ClusterState { }); } - protected async getEventCount(): Promise { - if (!this.isAdmin) { - return 0; - } - const client = this.getProxyKubeconfig().makeApiClient(CoreV1Api); - try { - const response = await client.listEventForAllNamespaces(false, null, null, null, 1000); - const uniqEventSources = new Set(); - const warnings = response.body.items.filter(e => e.type !== 'Normal'); - for (const w of warnings) { - if (w.involvedObject.kind === 'Pod') { - try { - const { body: pod } = await client.readNamespacedPod(w.involvedObject.name, w.involvedObject.namespace); - logger.debug(`checking pod ${w.involvedObject.namespace}/${w.involvedObject.name}`); - if (podHasIssues(pod)) { - uniqEventSources.add(w.involvedObject.uid); - } - } catch (err) { - } - } else { - uniqEventSources.add(w.involvedObject.uid); - } - } - const nodes = (await client.listNode()).body.items; - const nodeNotificationCount = nodes - .map(getNodeWarningConditions) - .reduce((sum, conditions) => sum + conditions.length, 0); - return uniqEventSources.size + nodeNotificationCount; - } catch (error) { - logger.error("Failed to fetch event count: " + JSON.stringify(error)); - return 0; - } - } - toJSON(): ClusterModel { const model: ClusterModel = { id: this.id,