Conversation
Signed-off-by: Nicolas Thiebaud <nicothieb@google.com>
|
cc: @htuch |
|
cc @mattklein123 for an initial review |
htuch
left a comment
There was a problem hiding this comment.
Super excited to see this. Some comments to kick off the review.
| public: | ||
| virtual ~ClusterUpdateCallbacks() {} | ||
|
|
||
| virtual void onClusterAddOrUpdate(const ThreadLocalCluster& cluster) PURE; |
There was a problem hiding this comment.
Needs Doxygen comments (see rest of file for examples to mimic style).
| virtual void addClusterUpdateCallbacks(ClusterUpdateCallbacks& callbacks) PURE; | ||
| virtual void removeClusterUpdateCallbacks(ClusterUpdateCallbacks& callbacks) PURE; | ||
|
|
||
| virtual LazyLoader* lazyLoader() const PURE; |
There was a problem hiding this comment.
All of these need comments as above.
|
|
||
| /** | ||
| * Lazy loading is only available when using CDS, bootstrap with static clusters will not support | ||
| * lazy loading. |
There was a problem hiding this comment.
Is this true if we have independent lazy CDS config source in the bootstrap as in envoyproxy/data-plane-api#524?
| public: | ||
| virtual ~LazyLoader() {} | ||
|
|
||
| virtual void loadCluster(const std::string& cluster) PURE; |
| */ | ||
| virtual bool addedViaApi() const PURE; | ||
|
|
||
| virtual bool addedLazily() const PURE; |
There was a problem hiding this comment.
More so than my comment on envoyproxy/data-plane-api#524, I think this is where we might want to think about how to reconcile incremental and lazy loading. As a strawman, I'd suggest there is no difference between an incremental cluster addition on a regular CDS channel and a lazy loaded cluster. WDYT? @mattklein123 as well.
There was a problem hiding this comment.
I agree. Ideally if we could extend the xDS API with incremental updates and incremental subscriptions (or hint) we could handle lazy loading with a single stream and reconcile quite a bit of this logic.
Has there been any work / discussion on this? Should I start a data-plane-api proposal?
There was a problem hiding this comment.
I started a strawman proposal here: envoyproxy/data-plane-api#527
There was a problem hiding this comment.
I need to spend heads down time with this next week, but at a high level if we can handle lazy loading w/ incremental lets just do incremental. We will get much bigger bang for the buck here. I will focus mostly on helping work through the issues in envoyproxy/data-plane-api#527.
| hdrs = ["cluster_manager_impl.h"], | ||
| srcs = [ | ||
| "cluster_manager_impl.cc", | ||
| "lazy_loader_impl.cc", |
There was a problem hiding this comment.
Prefer to have lazy_loader_impl.* in their own lazy_load_lib target to keep fine grained dependencies for testing.
| std::unique_ptr<Config::Subscription<envoy::api::v2::Cluster>> subscription_; | ||
| Event::Dispatcher& primary_dispatcher_; | ||
| ClusterManagerImpl& cluster_manager_; | ||
|
|
| Event::Dispatcher& primary_dispatcher, | ||
| Runtime::RandomGenerator& random, | ||
| ClusterManagerImpl& cluster_manager, | ||
| Stats::Store& statsconst); |
| }; | ||
|
|
||
| void LazyLoaderImpl::loadCluster(const std::string& cluster) { | ||
| subscription_->updateResources({cluster}); |
There was a problem hiding this comment.
This is a bit strange use of the API for the subscription. Semantically, updateResources is saying "we now have a new set of resources we care about from this point forward". You want to say "send me an update for only this resource and forget about it when we're done". Or.. do we?
What should the behavior be for a lazy loaded cluster when it is modified at the management server? Do we want to have it pushed asynchronously? What are the plans for removal of clusters when they go away on the management server?
There was a problem hiding this comment.
This could be solved using a single stream for the cds impl and the lazy loader if we extended the xds api to do incremental. See my comment here #2740 (comment)
| cluster_manager_(cm) { | ||
| ASSERT(bootstrap.dynamic_resources().has_cds_config()); | ||
| if (bootstrap.dynamic_resources().has_ads_config()) { | ||
| // Create an ADS stream for the lazy loader. We can not reuse the cluster manager ADS stream. |
There was a problem hiding this comment.
I'm not sure if this is what we want for ADS. This will become clearer once we resolve envoyproxy/data-plane-api#524.
|
I'm going to close this out while we work on design. @nt is upstreaming individual PRs that are extracted from this. |
Signed-off-by: Kuat Yessenov <kuat@google.com>
Lazy loading
This PR addresses #2500 for cluster lazy loading. Key design points are:
Missing in this initial PR. guidance requested:
Risk Level: Medium (new feature)