question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DiscoveryClient watch the service catalog for changes and update does not work correctly, when all-namespaces: true

See original GitHub issue

DiscoveryClient watch the service catalog for changes and update.

This current code returns only the endpoints of the current namespace. List<Endpoints> endpoints = client.endpoints().list().getItems();

To return all endpoints according to filters and labels, when using all-namespaces: true, use the code below:

Map<String, String> serviceLabels = properties.getServiceLabels();
List<Endpoints> endpointsList = properties.isAllNamespaces() ?
     client.endpoints().inAnyNamespace().withLabels(serviceLabels).list().getItems()
	: client.endpoints().list().getItems();

spring-cloud-kubernetes version:1.0.4.BUILD-SNAPSHOT


package org.springframework.cloud.kubernetes.discovery;
public class KubernetesCatalogWatch implements ApplicationEventPublisherAware {
...
  public void catalogServicesWatch() {
    
    // bug
   //  List<Endpoints> endpoints = client.endpoints().list().getItems(); 

   //adjusted
   Map<String, String> serviceLabels = properties.getServiceLabels();
   List<Endpoints> endpointsList = properties.isAllNamespaces() ?
     client.endpoints().inAnyNamespace().withLabels(serviceLabels).list().getItems()
	: client.endpoints().list().getItems();
  
  }
}``

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ryanjbaxtercommented, Jun 24, 2020

@Haybu mind taking a look at this one?

0reactions
Capone1983commented, Jan 10, 2020

Has this been fixed?

I have the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

codecentric/spring-boot-admin - Gitter
Spring Cloud Kubernetes can also watch the Kubernetes service catalog for changes and update the DiscoveryClient implementation accordingly.
Read more >
3. DiscoveryClient for Kubernetes - Spring Cloud
This client lets you query Kubernetes endpoints (see services) by name. ... can also watch the Kubernetes service catalog for changes and update...
Read more >
Spring Boot Admin on Kubernetes - Piotr's TechBlog
In this tutorial you will learn how to run Spring Boot Admin on Kubernetes ... service catalog for changes and updating the DiscoveryClient...
Read more >
Spring Boot Admin on Kubernetes - Piotr's TechBlog
Spring Boot Admin should monitor only Spring Boot applications, ... watching service catalog for changes and updating the DiscoveryClient ...
Read more >
Is there a way to add service catalog view to update set?
Solved: Hello, I have changed service catalog and selected all the items that i want to see in it, but after that i...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found