-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Use local_info.node() instead of bootstrap.node() whenever possible #4120
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 2 commits
80b5498
6c263d3
fd3071e
1792e22
0655cf8
53c3671
8b0dd55
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 |
|---|---|---|
|
|
@@ -211,7 +211,7 @@ ClusterManagerImpl::ClusterManagerImpl(const envoy::config::bootstrap::v2::Boots | |
| // Now setup ADS if needed, this might rely on a primary cluster. | ||
| if (bootstrap.dynamic_resources().has_ads_config()) { | ||
| ads_mux_.reset(new Config::GrpcMuxImpl( | ||
| bootstrap.node(), | ||
| local_info.node(), | ||
| Config::Utility::factoryForGrpcApiConfigSource( | ||
| *async_client_manager_, bootstrap.dynamic_resources().ads_config(), stats) | ||
| ->create(), | ||
|
|
@@ -301,7 +301,7 @@ ClusterManagerImpl::ClusterManagerImpl(const envoy::config::bootstrap::v2::Boots | |
| if (cm_config.has_load_stats_config()) { | ||
| const auto& load_stats_config = cm_config.load_stats_config(); | ||
| load_stats_reporter_.reset( | ||
| new LoadStatsReporter(bootstrap.node(), *this, stats, | ||
| new LoadStatsReporter(local_info.node(), *this, stats, | ||
|
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. Another option, not saying you have to do this, is to treat the CLI flags as a bootstrap override and override the bootstrap proto early in server config, so that
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. +1, it would be great to have a single source of truth here. From an interface perspective it seems better to have LocalInfo be the source of truth but I don't feel that strongly about it.
Member
Author
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. Updated to use |
||
| Config::Utility::factoryForGrpcApiConfigSource( | ||
| *async_client_manager_, load_stats_config, stats) | ||
| ->create(), | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -132,6 +132,10 @@ class AdsIntegrationTest : public AdsIntegrationBaseTest, | |||
| envoy::api::v2::DiscoveryRequest discovery_request; | ||||
| VERIFY_ASSERTION(ads_stream_->waitForGrpcMessage(*dispatcher_, discovery_request)); | ||||
|
|
||||
| ASSERT(discovery_request.has_node()); | ||||
|
Contributor
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. I think while these envoy/test/server/lds_api_test.cc Line 203 in 0228180
Member
Author
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. Thanks for this. Will try to read and add a test. |
||||
| EXPECT_FALSE(discovery_request.node().id().empty()); | ||||
| EXPECT_FALSE(discovery_request.node().cluster().empty()); | ||||
|
|
||||
| // TODO(PiotrSikora): Remove this hack once fixed internally. | ||||
| if (!(expected_type_url == discovery_request.type_url())) { | ||||
| return AssertionFailure() << fmt::format("type_url {} does not match expected {}", | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,6 +164,9 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, | |
| return; | ||
| } else if (loadstats_request.cluster_stats_size() == 0) { | ||
| loadstats_request.CopyFrom(local_loadstats_request); | ||
| ASSERT(loadstats_request.has_node()); | ||
|
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. You probably want |
||
| EXPECT_FALSE(loadstats_request.node().id().empty()); | ||
| EXPECT_FALSE(loadstats_request.node().cluster().empty()); | ||
| return; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Can we add method similar to
Config::Utility::checkLocalInfo("ads", local_info)https://github.com/envoyproxy/envoy/blob/master/source/common/config/grpc_mux_impl.cc#L18
and validate that node has right info?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, we can. However currently, if we failed to supply the info, it firstly throws an error for "cds", which I think serves the same purpose.
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.
@ramaraochavali after an experiment, I think it is tempting to have
Config::Utility::checkLocalInfoinside theGrpcMuxImpl's constructor (and testing it is easier, yeay!). However, since we want to pass in thelocal_infohere, the implication is quite large (but mostly "replacing"nodewithlocal_info). I have the changeset ready but want to gather opinions about it.cc. @htuch @mattklein123.