-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KubernetesReactiveDiscoveryClient cache configuration issues #1641
Comments
Just trying to understand exactly what you are trying to achieve with caching… are you trying to cache the services returned by the discovery client so it doesn’t need to make a request to the api server/discovery server? |
these are some interesting issues, imo, but they all need to be broken down to being more specific and fix one at a time. I can definitely give it a try. I will only present my idea for one of them, and if agreed, will gradually move to the next ones. The first issue I see is that we should provide cacheable and non-cacheable discovery clients (both in fabric8 and native client), that could be switched between each other by a setting, for example: So, if in your app:
There are some things to discuss in such an approach. Currently, reactive native client already has If we go with such an approach, we should evict entries. We do have If this sounds reasonable, I can create a separate issue, add all the details in there and fix it; then move to the next one in this thread and so on. Just let me know your thoughts Ryan. Thank you |
I don't think there is a good solution that doesn't cause someone some amount of pain, its unfortunate that one of the clients already has |
yeah, agreed. can we leave this one open until those breaking are allowed then? |
Yes, but also I would like to explore if we need to make any changes/fixes to the code base today to all things to be cached by using custom bean definitions |
you mean like a So that for example users could opt-in into such a functionality? Did I understand you correctly? |
No what I am concerned about is that there is something in the way we have implemented the discovery client that would prevent users from providing their own caching implementation |
Describe the bug
Spring Cloud 2023.0.1 (and prior)
We have an ecosystem of spring boot microservices, some are reactive and some are blocking. Some have their own need for caching and some don't. We have run into an issue with the presence of the @Cacheable annotation in
KubernetesReactiveDiscoveryClient
in reactive microservices that have@EnableCaching
for their own purposes.This has surfaced as several issues:
DefaultKubernetesServiceInstance
is notSerializable
, preventing some caching implementations from functioning correctly by defaultDefaultKubernetesServiceInstance
fails by default because the properties discovered by the getters don't match whats available in the constructor. This requires configuring the ObjectMapper to ignore unknown properties.spring.cloud.kubernetes.loadbalancer.mode=POD
the cached value of the discovered services is the POD address which changes on redeploy, and there is nothing setup to invalidate the cache.While I'm not convinced there is necessarily a bug here, I am concerned on the lack of documentation. What sort of cache configuration is expected to be in place (backend library, TTL, etc) for the reactive discovery client to behave as intended? Additionally, was the caching behavior in the reactive version of the class intended to be different from the blocking version?
The text was updated successfully, but these errors were encountered: