DiscoveryClient watch the service catalog for changes and update does not work correctly, when all-namespaces: true
See original GitHub issueDiscoveryClient 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:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Haybu mind taking a look at this one?
Has this been fixed?
I have the same issue.