upstream: add CDS LbSubsetConfig to ClusterInfo#1837
Merged
htuch merged 3 commits intoenvoyproxy:masterfrom Oct 11, 2017
Merged
upstream: add CDS LbSubsetConfig to ClusterInfo#1837htuch merged 3 commits intoenvoyproxy:masterfrom
htuch merged 3 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
htuch
reviewed
Oct 11, 2017
| virtual ~LoadBalancerSubsetInfo() {} | ||
|
|
||
| /** | ||
| * @return true if load balancer subsets are configured. |
Member
There was a problem hiding this comment.
Nit: @return bool true if load ... etc. and below.
| virtual bool isEnabled() const PURE; | ||
|
|
||
| /** | ||
| * @return the fallback policy used when route metadata does not match any subset. |
Member
There was a problem hiding this comment.
(can probably skip the namespace here though, since it's like half a mile long)
| : enabled_(subset_config.subset_selectors_size() != 0), | ||
| fallback_policy_(subset_config.fallback_policy()), | ||
| default_subset_(subset_config.default_subset()) { | ||
| for (auto subset : subset_config.subset_selectors()) { |
| fallback_policy_(subset_config.fallback_policy()), | ||
| default_subset_(subset_config.default_subset()) { | ||
| for (auto subset : subset_config.subset_selectors()) { | ||
| if (subset.keys_size() > 0) { |
| class LoadBalancerSubsetInfoImpl : public LoadBalancerSubsetInfo { | ||
| public: | ||
| LoadBalancerSubsetInfoImpl(const envoy::api::v2::Cluster::LbSubsetConfig& subset_config) | ||
| : enabled_(subset_config.subset_selectors_size() != 0), |
Member
There was a problem hiding this comment.
subset_config.subset_selectors.empty()?
| const std::vector<std::set<std::string>>& subsetKeys() const override { return subset_keys_; } | ||
|
|
||
| private: | ||
| bool enabled_; |
Member
There was a problem hiding this comment.
Nit: some of these can be const as initialized in constructor.
| auto subset_config = envoy::api::v2::Cluster::LbSubsetConfig::default_instance(); | ||
| subset_config.set_fallback_policy(envoy::api::v2::Cluster::LbSubsetConfig::DEFAULT_SUBSET); | ||
| subset_config.mutable_default_subset()->mutable_fields()->insert({"key", subset_value}); | ||
| subset_config.mutable_subset_selectors()->Add()->CopyFrom(subset_selector); |
Member
There was a problem hiding this comment.
Nit: If you build this in the reverse direction (i.e. acquire the selector via subset_config.mutable_subset_selectors()->Add()), you don't have to copy.
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
mattklein123
approved these changes
Oct 11, 2017
Member
mattklein123
left a comment
There was a problem hiding this comment.
LGTM pending any further @htuch comments.
htuch
approved these changes
Oct 11, 2017
rshriram
pushed a commit
to rshriram/envoy
that referenced
this pull request
Oct 30, 2018
…oxy#1837) * Add two new attributes: request.url_path and request.queries * Update api in repositories.bzl
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Second PR split out of #1735.
This one adds the LbSubsetConfig data from the CDS Cluster message to the existing ClusterInfo class.