correct order (discovery clean-up part-2) (#1497)
This commit is contained in:
@@ -75,17 +75,17 @@ final class Fabric8KubernetesDiscoveryClientUtils {
|
||||
|
||||
List<Endpoints> endpoints;
|
||||
|
||||
if (properties.allNamespaces()) {
|
||||
LOG.debug(() -> "discovering endpoints in all namespaces");
|
||||
endpoints = filteredEndpoints(client.endpoints().inAnyNamespace().withNewFilter(), properties, serviceName);
|
||||
}
|
||||
else if (!properties.namespaces().isEmpty()) {
|
||||
if (!properties.namespaces().isEmpty()) {
|
||||
LOG.debug(() -> "discovering endpoints in namespaces : " + properties.namespaces());
|
||||
List<Endpoints> inner = new ArrayList<>(properties.namespaces().size());
|
||||
properties.namespaces().forEach(namespace -> inner.addAll(filteredEndpoints(
|
||||
client.endpoints().inNamespace(namespace).withNewFilter(), properties, serviceName)));
|
||||
endpoints = inner;
|
||||
}
|
||||
else if (properties.allNamespaces()) {
|
||||
LOG.debug(() -> "discovering endpoints in all namespaces");
|
||||
endpoints = filteredEndpoints(client.endpoints().inAnyNamespace().withNewFilter(), properties, serviceName);
|
||||
}
|
||||
else {
|
||||
String namespace = Fabric8Utils.getApplicationNamespace(client, null, target, namespaceProvider);
|
||||
LOG.debug(() -> "discovering endpoints in namespace : " + namespace);
|
||||
|
||||
@@ -187,7 +187,9 @@ public class KubernetesDiscoveryClient implements DiscoveryClient, EnvironmentAw
|
||||
|
||||
@Override
|
||||
public List<String> getServices() {
|
||||
return adapter.apply(client).stream().map(s -> s.getMetadata().getName()).distinct().toList();
|
||||
List<String> services = adapter.apply(client).stream().map(s -> s.getMetadata().getName()).distinct().toList();
|
||||
LOG.debug(() -> "will return services : " + services);
|
||||
return services;
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
|
||||
@@ -143,7 +143,7 @@ class Fabric8KubernetesCatalogWatchEndpointsTests extends Fabric8EndpointsAndEnd
|
||||
@Override
|
||||
void testAllNamespacesTrueOtherBranchesNotCalled() {
|
||||
|
||||
KubernetesCatalogWatch watch = createWatcherInAllNamespacesWithLabels(Map.of("color", "blue"), Set.of("B"),
|
||||
KubernetesCatalogWatch watch = createWatcherInAllNamespacesWithLabels(Map.of("color", "blue"), Set.of(),
|
||||
ENDPOINT_SLICES);
|
||||
|
||||
endpoints("namespaceA", Map.of(), "podA");
|
||||
|
||||
Reference in New Issue
Block a user