KEMBAR78
correct order (discovery clean-up part-2) by wind57 · Pull Request #1497 · spring-cloud/spring-cloud-kubernetes · GitHub
Skip to content

Conversation

@wind57
Copy link
Contributor

@wind57 wind57 commented Nov 3, 2023

No description provided.


@Override
public List<String> getServices() {
return adapter.apply(client).stream().map(s -> s.getMetadata().getName()).distinct().toList();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change here is to add:

LOG.debug(() -> "will return services : " + services);

because the k8s client has such a debug log, and this one does not

endpoints = filteredEndpoints(client.endpoints().inAnyNamespace().withNewFilter(), properties, serviceName);
}
else if (!properties.namespaces().isEmpty()) {
if (!properties.namespaces().isEmpty()) {
Copy link
Contributor Author

@wind57 wind57 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is a bit subtle.

So when users call DiscoveryClient::getServices, we provide a response based on this exact order:

  • selective namespaces
  • all namespaces
  • namespace based on "namespace resolution"

depending on which property is enabled.

With that result, they will call getInstances; but this time, as seen in this code, we will not use the abive order. Instead we will use:

  • all namespaces
  • selective namespaces
  • namespace based on "namespace" resolution

It is highly unlikely that this can cause problems, and no one reported such a problem, nevertheless, this is a bug, imo.

@wind57 wind57 changed the title correct order correct order (discovery clean-up part2) Nov 4, 2023
@wind57 wind57 changed the title correct order (discovery clean-up part2) correct order (discovery clean-up part-2) Nov 4, 2023
@wind57 wind57 marked this pull request as ready for review November 7, 2023 19:30
@wind57
Copy link
Contributor Author

wind57 commented Nov 7, 2023

@ryanjbaxter minor bug fix. Thank you

@ryanjbaxter ryanjbaxter added this to the 3.0.5 milestone Nov 7, 2023
@ryanjbaxter ryanjbaxter merged commit 088e27a into spring-cloud:3.0.x Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants