-
Notifications
You must be signed in to change notification settings - Fork 5.3k
api: allow multiple type URLs for xDS #10788
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,6 @@ | |
| #include "common/common/fmt.h" | ||
| #include "common/common/utility.h" | ||
| #include "common/config/new_grpc_mux_impl.h" | ||
| #include "common/config/resources.h" | ||
| #include "common/config/utility.h" | ||
| #include "common/config/version_converter.h" | ||
| #include "common/grpc/async_client_manager_impl.h" | ||
|
|
@@ -143,16 +142,21 @@ void ClusterManagerInitHelper::maybeFinishInitialize() { | |
| if (!secondary_init_clusters_.empty()) { | ||
| if (!started_secondary_initialize_) { | ||
| ENVOY_LOG(info, "cm init: initializing secondary clusters"); | ||
| const auto target_type_urls = | ||
| Config::getAllVersionTypeUrls<envoy::config::endpoint::v3::ClusterLoadAssignment>(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a regression in terms of reducing the amount of version hardcoding; before we could just do |
||
|
|
||
| // If the first CDS response doesn't have any primary cluster, ClusterLoadAssignment | ||
| // should be already paused by CdsApiImpl::onConfigUpdate(). Need to check that to | ||
| // avoid double pause ClusterLoadAssignment. | ||
| if (cm_.adsMux() == nullptr || | ||
| cm_.adsMux()->paused(Config::TypeUrl::get().ClusterLoadAssignment)) { | ||
| if (cm_.adsMux() == nullptr) { | ||
| initializeSecondaryClusters(); | ||
| } else { | ||
| cm_.adsMux()->pause(Config::TypeUrl::get().ClusterLoadAssignment); | ||
| Cleanup eds_resume( | ||
| [this] { cm_.adsMux()->resume(Config::TypeUrl::get().ClusterLoadAssignment); }); | ||
| for (auto&& type_url : target_type_urls) { | ||
| if (!cm_.adsMux()->paused(type_url)) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, I think we're still mixing two unrelated PRs; switching to non-hardcoded type URLs and supporting multiple type URLs. |
||
| cm_.adsMux()->pause(type_url); | ||
| Cleanup eds_resume([this, type_url] { cm_.adsMux()->resume(type_url); }); | ||
| } | ||
| } | ||
| initializeSecondaryClusters(); | ||
| } | ||
| } | ||
|
|
@@ -753,10 +757,12 @@ void ClusterManagerImpl::updateClusterCounts() { | |
| // If we're in the middle of shutting down (ads_mux_ already gone) then this is irrelevant. | ||
| if (ads_mux_) { | ||
| const uint64_t previous_warming = cm_stats_.warming_clusters_.value(); | ||
| const auto target_type_urls = | ||
| Config::getAllVersionTypeUrls<envoy::config::cluster::v3::Cluster>(); | ||
| if (previous_warming == 0 && !warming_clusters_.empty()) { | ||
| ads_mux_->pause(Config::TypeUrl::get().Cluster); | ||
| ads_mux_->pause(target_type_urls); | ||
| } else if (previous_warming > 0 && warming_clusters_.empty()) { | ||
| ads_mux_->resume(Config::TypeUrl::get().Cluster); | ||
| ads_mux_->resume(target_type_urls); | ||
| } | ||
| } | ||
| cm_stats_.active_clusters_.set(active_clusters_.size()); | ||
|
|
@@ -1377,4 +1383,4 @@ ProdClusterManagerFactory::createCds(const envoy::config::core::v3::ConfigSource | |
| } | ||
|
|
||
| } // namespace Upstream | ||
| } // namespace Envoy | ||
| } // namespace Envoy | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need some unit tests for these vectored pause/resume methods?