diff --git a/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java b/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java index 27cacb990..92e6695c3 100644 --- a/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java +++ b/src/main/java/io/cryostat/discovery/KubeApiDiscovery.java @@ -193,13 +193,11 @@ private List getTargetTuplesFrom(Endpoints endpoints) { public void handleEndpointEvent(TargetTuple tuple, EventKind eventKind) { DiscoveryNode realm = DiscoveryNode.getRealm(REALM).orElseThrow(); DiscoveryNode nsNode = - DiscoveryNode.environment( - tuple.objRef.getNamespace(), KubeDiscoveryNodeType.NAMESPACE); - if (realm.children.contains(nsNode)) { - nsNode = - DiscoveryNode.getChild(realm, n -> tuple.objRef.getNamespace().equals(n.name)) - .orElseThrow(); - } + DiscoveryNode.getChild(realm, n -> tuple.objRef.getNamespace().equals(n.name)) + .orElse( + DiscoveryNode.environment( + tuple.objRef.getNamespace(), + KubeDiscoveryNodeType.NAMESPACE)); switch (eventKind) { case FOUND: