-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
router: correct cluster name for ads in routes #2449
Merged
mattklein123
merged 11 commits into
envoyproxy:master
from
ramaraochavali:fix/rds-cluster-name
Feb 1, 2018
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
82527a1
correct cluster name for ads in routes
ramaraochavali de59b03
dumped the proto
ramaraochavali faf0d8c
changed variable and method names, fixed tests
ramaraochavali ccec8ed
changed cluster_config to config_source
ramaraochavali 6af94cb
fixed tests
ramaraochavali 6bc4587
added pretty print support for protobuf json
ramaraochavali 195f256
changed rds_impl_test.cc to adhere to new formatted print
ramaraochavali a4df1fb
changed the doc
ramaraochavali b53faa9
added DCO signoff
ramaraochavali 8b8078d
added DCO signoff
ramaraochavali 67dc1cf
removed the unnecessary if and else part
ramaraochavali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,10 +73,10 @@ RdsRouteConfigProviderImpl::RdsRouteConfigProviderImpl( | |
// In V2 we use a Subscription model where the fetch can happen via gRPC, REST, or | ||
// local filesystem. If the subscription happens via local filesystem (e.g xds_integration_test), | ||
// then there is no actual RDS server, and hence no RDS cluster name. | ||
if (rds.has_config_source() && rds.config_source().has_api_config_source()) { | ||
cluster_name_ = rds.config_source().api_config_source().cluster_names()[0]; | ||
if (rds.has_config_source()) { | ||
config_source_ = MessageUtil::getJsonStringFromMessage(rds.config_source(), true); | ||
} else { | ||
cluster_name_ = "NOT_USING_CLUSTER"; | ||
config_source_ = "{}"; | ||
} | ||
} | ||
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 whole if (rds.has_config_source()) {
cluster_source_ = MessageUtil::getJsonStringFromMessage(rds.config_source());
} |
||
|
||
|
@@ -247,7 +247,7 @@ Http::Code RouteConfigProviderManagerImpl::handlerRoutesLoop( | |
response.add("{\n"); | ||
response.add(fmt::format("\"version_info\": \"{}\",\n", provider->versionInfo())); | ||
response.add(fmt::format("\"route_config_name\": \"{}\",\n", provider->routeConfigName())); | ||
response.add(fmt::format("\"cluster_name\": \"{}\",\n", provider->clusterName())); | ||
response.add(fmt::format("\"config_source\": {},\n", provider->configSource())); | ||
response.add("\"route_table_dump\": "); | ||
response.add(fmt::format("{}\n", provider->configAsJson())); | ||
response.add("}\n"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Sorry quick question: Is there a test that should have caught this (switching to
{}
)? Is it easy to add one?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.
@mattklein123 there is no test. Will look in to adding it. One more thing, /routes is not working for routes defined statically. It is only iterating through the RdsRouteConfigProviders. https://github.com/envoyproxy/envoy/blob/master/source/common/router/rds_impl.cc#L215. Also it does not store the StaticRouteConfigProviders any where. Is this intentional or a bug? @htuch your thoughts?
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.
and the else block changing config_source = {}, I think we can get rid of the else block completely because if rds is configured, with out config_source, EnvoyException will be thrown. And that is validated with this test https://github.com/envoyproxy/envoy/blob/master/test/common/router/rds_impl_test.cc#L126.
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.
It just wasn't implemented. In the context of #2421 we will want to revisit this.
Yup, great catch. If the code can't be hit just delete it and remove the if statement entirely. Thanks!