Fix unhandled exception in visibility handler (#3291)

- If an KubernetesCluster entity is being deleted then the
  catalogEntityRegistry.getById() will return undefined. This leads to
  an unhandled exception in the handler because we tried to read
  apiVersion. This commit changes it so that we get the apiVersion and
  kind from KubernetesCluster class itself

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-07-07 09:30:07 +03:00
1 parent b03eb443c9
commit a301283adc
3 files changed
+13 -6

No files matched your search

@@ -62,8 +62,11 @@ export interface KubernetesClusterStatus extends CatalogEntityStatus {
}
export class KubernetesCluster extends CatalogEntity<CatalogEntityMetadata, KubernetesClusterStatus, KubernetesClusterSpec> {
public readonly apiVersion = "entity.k8slens.dev/v1alpha1";
public readonly kind = "KubernetesCluster";
public static readonly apiVersion = "entity.k8slens.dev/v1alpha1";
public static readonly kind = "KubernetesCluster";
public readonly apiVersion = KubernetesCluster.apiVersion;
public readonly kind = KubernetesCluster.kind;
async connect(): Promise<void> {
if (app) {