Skip to content
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

WIP: VHDS: on-demand updates #6552

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f66b55a
Base implementation of VHDS
Jan 22, 2019
0e6c97e
additional formatting fixes
Apr 3, 2019
b447f33
More formatting fixes
Apr 3, 2019
2da973f
more formatting fixes
Apr 3, 2019
21bb7af
Fixing test failures
Apr 3, 2019
2a6c77f
wrapped update details into a dedicated class
Apr 3, 2019
dbafd58
fixing build failures
Apr 3, 2019
200aa3d
Fixing build failures
Apr 4, 2019
68d7c52
Added more vhds tests
Apr 4, 2019
e692f0e
Fixed formatting errors
Apr 4, 2019
38da6ab
fixes based on the PR feedback
Apr 10, 2019
9a14662
fixed a spelling mistake
Apr 10, 2019
33f795b
moved out VhdsSubscription class into its own file
Apr 10, 2019
7a40f59
VHDS: Filter-based on-demand RDS updates
Jan 22, 2019
78acd5c
Merged changes from master
May 14, 2019
96a6c90
Fixes after merging latest changes
May 16, 2019
fe73bbd
Reponded to feedback
May 16, 2019
374de2c
Moved on-demand filter to extensions/filters/http/on_demand dir
May 16, 2019
1c8c52f
Merge branch 'master' into vhds-on-demand
May 16, 2019
c5e314a
fix to build kafka extension under python3
May 17, 2019
28e6ad3
Merge branch 'master' into vhds-on-demand
May 29, 2019
bd11db6
Post-merge fixes
May 29, 2019
bf63b6d
Renamed requestRouteConfigUpdate to requestVirtualHostsUpdate, update…
May 29, 2019
bbc38b4
Added comments re: stream restart after route config update
May 29, 2019
01eca26
Fixing build issues
May 29, 2019
72896bb
Fixing build issues
May 29, 2019
2592cce
Fixing build issues
May 30, 2019
e5d9d94
Fixed formatting issues
May 30, 2019
7bab936
Fixing build issues
May 30, 2019
852c51b
Fixing build issues
May 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/envoy/config/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "envoy/common/pure.h"
#include "envoy/stats/stats_macros.h"

#include "common/common/assert.h"
#include "common/protobuf/protobuf.h"

namespace Envoy {
Expand Down Expand Up @@ -79,6 +80,10 @@ class Subscription {
* be passed to std::set_difference, which must be given sorted collections.
*/
virtual void updateResources(const std::set<std::string>& update_to_these_names) PURE;

virtual void updateResourcesViaAliases(const std::set<std::string>&) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add Doxygen docs for this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am perceiving the intention correctly, I think you might also want to change the name. updateResources() is kind of misnamed; it's not about getting updated resources, but rather updating the set of resource names we care about. Similarly, it looks like this one is about adding to a list of aliases, not updating resources.

...so I guess I'm really saying now would be a good time to give updateResources() a better name. Can I suggest something like either updateResourceInterest or updateSubscriptionInterest?

As for the aliases one, since it looks like it's more of a blanket addition than a "replace with this set" (which is how updateResources currently works), I would suggest like addAliases or addResourceAliases.

NOT_IMPLEMENTED_GCOVR_EXCL_LINE;
}
};

/**
Expand Down
2 changes: 2 additions & 0 deletions include/envoy/http/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ class StreamFilterCallbacks {
*/
virtual Router::RouteConstSharedPtr route() PURE;

virtual bool requestRouteConfigUpdate(std::function<void()> cb) PURE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add Doxygen docs for this?


/**
* Returns the clusterInfo for the cached route.
* This method is to avoid multiple look ups in the filter chain, it also provides a consistent
Expand Down
11 changes: 11 additions & 0 deletions include/envoy/router/rds.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ class RouteConfigProvider {
* Callback used to notify RouteConfigProvider about configuration changes.
*/
virtual void onConfigUpdate() PURE;

/**
* Callback used to request an update to the route configuration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An update from the management server?

* @param for_domain supplies the domain name that virtual hosts contained in the VHDS response
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit confusing, as it is an update request, but the thing we're requesting is referencing the response..

* must match on
* @param cb callback to be called when the configuration update has been propagated to worker
* threads
* @return whether a request for a configuration update has been successfully scheduled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How/why can this fail?

*/
virtual bool requestVirtualHostsUpdate(const std::string& for_domain,
std::function<void()> cb) PURE;
};

typedef std::unique_ptr<RouteConfigProvider> RouteConfigProviderPtr;
Expand Down
7 changes: 7 additions & 0 deletions source/common/config/delta_subscription_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ void DeltaSubscriptionImpl::updateResources(const std::set<std::string>& update_
trySendDiscoveryRequests();
}

void DeltaSubscriptionImpl::updateResourcesViaAliases(
const std::set<std::string>& updates_to_these_aliases) {
state_->updateResourceInterestViaAliases(updates_to_these_aliases);
// Tell the server about our new interests, if there are any.
trySendDiscoveryRequests();
}

// Config::GrpcStreamCallbacks
void DeltaSubscriptionImpl::onStreamEstablished() {
state_->markStreamFresh();
Expand Down
1 change: 1 addition & 0 deletions source/common/config/delta_subscription_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class DeltaSubscriptionImpl : public Subscription,
// Config::Subscription
void start(const std::set<std::string>& resources, SubscriptionCallbacks& callbacks) override;
void updateResources(const std::set<std::string>& update_to_these_names) override;
void updateResourcesViaAliases(const std::set<std::string>& updates_to_these_aliases) override;

// Config::GrpcStreamCallbacks
void onStreamEstablished() override;
Expand Down
33 changes: 28 additions & 5 deletions source/common/config/delta_subscription_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ void DeltaSubscriptionState::updateResourceInterest(
}
}

void DeltaSubscriptionState::updateResourceInterestViaAliases(
const std::set<std::string>& updates_to_these_aliases) {
aliases_added_.insert(updates_to_these_aliases.begin(), updates_to_these_aliases.end());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd want to see some more documentation/comments on how this module works with aliases, could you add some? CC @fredlas for this module review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One surface-level (since I don't know how it's supposed to work) question to double check you're doing what you intend: is it your intention that aliases are only ever added, not removed? Or, it looks like the actual mechanism is that these aliases just go into resource_names_subscribe; does that mean that to remove them, you are supposed to just do a normal unsubscribe of those names?

}

// Not having sent any requests yet counts as an "update pending" since you're supposed to resend
// the entirety of your interest at the start of a stream, even if nothing has changed.
bool DeltaSubscriptionState::subscriptionUpdatePending() const {
return !names_added_.empty() || !names_removed_.empty() ||
return !aliases_added_.empty() || !names_added_.empty() || !names_removed_.empty() ||
!any_request_sent_yet_in_current_stream_;
}

Expand Down Expand Up @@ -157,6 +162,28 @@ void DeltaSubscriptionState::handleEstablishmentFailure() {

envoy::api::v2::DeltaDiscoveryRequest DeltaSubscriptionState::getNextRequest() {
envoy::api::v2::DeltaDiscoveryRequest request;
if (!any_request_sent_yet_in_current_stream_) {
populateDiscoveryRequest(request);
} else if (!aliases_added_.empty()) {
populateDiscoveryRequestWithAliases(request);
} else {
populateDiscoveryRequest(request);
}

request.set_type_url(type_url_);
request.mutable_node()->MergeFrom(local_info_.node());
return request;
}

void DeltaSubscriptionState::populateDiscoveryRequestWithAliases(
envoy::api::v2::DeltaDiscoveryRequest& request) {
std::copy(aliases_added_.begin(), aliases_added_.end(),
Protobuf::RepeatedFieldBackInserter(request.mutable_resource_names_subscribe()));
aliases_added_.clear();
}

void DeltaSubscriptionState::populateDiscoveryRequest(
envoy::api::v2::DeltaDiscoveryRequest& request) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may be able to factor out the if (!any_request_sent_yet_in_current_stream_) block from populateDiscoveryRequest into its own function. Then, rather than having ifs+elses in getNextRequest(), you could just do

if (!any_request_sent_yet_in_current_stream_)
  prepareFirstRequest(request);
if (!aliases_added_.empty())
  populateWithAliases(request);
populateDiscoveryRequest(request);

if (!any_request_sent_yet_in_current_stream_) {
any_request_sent_yet_in_current_stream_ = true;
// initial_resource_versions "must be populated for first request in a stream".
Expand All @@ -181,10 +208,6 @@ envoy::api::v2::DeltaDiscoveryRequest DeltaSubscriptionState::getNextRequest() {
Protobuf::RepeatedFieldBackInserter(request.mutable_resource_names_unsubscribe()));
names_added_.clear();
names_removed_.clear();

request.set_type_url(type_url_);
request.mutable_node()->MergeFrom(local_info_.node());
return request;
}

void DeltaSubscriptionState::disableInitFetchTimeoutTimer() {
Expand Down
4 changes: 4 additions & 0 deletions source/common/config/delta_subscription_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class DeltaSubscriptionState : public Logger::Loggable<Logger::Id::config> {

// Update which resources we're interested in subscribing to.
void updateResourceInterest(const std::set<std::string>& update_to_these_names);
void updateResourceInterestViaAliases(const std::set<std::string>& updates_to_these_aliases);

// Whether there was a change in our subscription interest we have yet to inform the server of.
bool subscriptionUpdatePending() const;
Expand Down Expand Up @@ -75,6 +76,8 @@ class DeltaSubscriptionState : public Logger::Loggable<Logger::Id::config> {
void setResourceVersion(const std::string& resource_name, const std::string& resource_version);
void setResourceWaitingForServer(const std::string& resource_name);
void setLostInterestInResource(const std::string& resource_name);
void populateDiscoveryRequest(envoy::api::v2::DeltaDiscoveryRequest& request);
void populateDiscoveryRequestWithAliases(envoy::api::v2::DeltaDiscoveryRequest& request);

// A map from resource name to per-resource version. The keys of this map are exactly the resource
// names we are currently interested in. Those in the waitingForServer state currently don't have
Expand All @@ -99,6 +102,7 @@ class DeltaSubscriptionState : public Logger::Loggable<Logger::Id::config> {
// Feel free to change to unordered if you can figure out how to make it work.
std::set<std::string> names_added_;
std::set<std::string> names_removed_;
std::set<std::string> aliases_added_;

SubscriptionStats& stats_;
};
Expand Down
4 changes: 4 additions & 0 deletions source/common/http/async_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class AsyncStreamImpl : public AsyncClient::Stream,
AsyncStreamImpl(AsyncClientImpl& parent, AsyncClient::StreamCallbacks& callbacks,
const AsyncClient::StreamOptions& options);

bool requestRouteConfigUpdate(std::function<void()>) override { return false; }

// Http::AsyncClient::Stream
void sendHeaders(HeaderMap& headers, bool end_stream) override;
void sendData(Buffer::Instance& data, bool end_stream) override;
Expand Down Expand Up @@ -367,6 +369,8 @@ class AsyncRequestImpl final : public AsyncClient::Request,
AsyncRequestImpl(MessagePtr&& request, AsyncClientImpl& parent, AsyncClient::Callbacks& callbacks,
const AsyncClient::RequestOptions& options);

bool requestRouteConfigUpdate(std::function<void()>) override { return false; }

// AsyncClient::Request
virtual void cancel() override;

Expand Down
16 changes: 15 additions & 1 deletion source/common/http/conn_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ void ConnectionManagerImpl::chargeTracingStats(const Tracing::Reason& tracing_re

ConnectionManagerImpl::ActiveStream::ActiveStream(ConnectionManagerImpl& connection_manager)
: connection_manager_(connection_manager),
route_config_provider_(connection_manager.config_.routeConfigProvider()),
snapped_route_config_(connection_manager.config_.routeConfigProvider().config()),
stream_id_(connection_manager.random_generator_.random()),
request_response_timespan_(new Stats::Timespan(
Expand Down Expand Up @@ -1125,6 +1126,7 @@ void ConnectionManagerImpl::ActiveStream::refreshCachedRoute() {
Router::RouteConstSharedPtr route;
if (request_headers_ != nullptr) {
route = snapped_route_config_->route(*request_headers_, stream_id_);
// route = route_config_provider_.config()->route(*request_headers_, stream_id_);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

}
stream_info_.route_entry_ = route ? route->routeEntry() : nullptr;
cached_route_ = std::move(route);
Expand All @@ -1137,6 +1139,13 @@ void ConnectionManagerImpl::ActiveStream::refreshCachedRoute() {
}
}

bool ConnectionManagerImpl::ActiveStream::requestRouteConfigUpdate(std::function<void()> cb) {
ASSERT(!request_headers_->Host()->value().empty());
auto host_header =
Http::LowerCaseString(std::string(request_headers_->Host()->value().getStringView())).get();
return route_config_provider_.requestVirtualHostsUpdate(host_header, cb);
}

void ConnectionManagerImpl::ActiveStream::sendLocalReply(
bool is_grpc_request, Code code, absl::string_view body,
const std::function<void(HeaderMap& headers)>& modify_headers, bool is_head_request,
Expand Down Expand Up @@ -1819,13 +1828,18 @@ Upstream::ClusterInfoConstSharedPtr ConnectionManagerImpl::ActiveStreamFilterBas
}

Router::RouteConstSharedPtr ConnectionManagerImpl::ActiveStreamFilterBase::route() {
if (!parent_.cached_route_.has_value()) {
if (!parent_.cached_route_.has_value() || parent_.cached_route_.value() == nullptr) {
parent_.refreshCachedRoute();
}

return parent_.cached_route_.value();
}

bool ConnectionManagerImpl::ActiveStreamFilterBase::requestRouteConfigUpdate(
std::function<void()> cb) {
return parent_.requestRouteConfigUpdate(cb);
}

void ConnectionManagerImpl::ActiveStreamFilterBase::clearRouteCache() {
parent_.cached_route_ = absl::optional<Router::RouteConstSharedPtr>();
parent_.cached_cluster_info_ = absl::optional<Upstream::ClusterInfoConstSharedPtr>();
Expand Down
4 changes: 4 additions & 0 deletions source/common/http/conn_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class ConnectionManagerImpl : Logger::Loggable<Logger::Id::http>,
Event::Dispatcher& dispatcher() override;
void resetStream() override;
Router::RouteConstSharedPtr route() override;
bool requestRouteConfigUpdate(std::function<void()> cb) override;
Upstream::ClusterInfoConstSharedPtr clusterInfo() override;
void clearRouteCache() override;
uint64_t streamId() override;
Expand Down Expand Up @@ -318,6 +319,7 @@ class ConnectionManagerImpl : Logger::Loggable<Logger::Id::http>,

void responseDataTooLarge();
void responseDataDrained();
bool requestRouteConfigUpdate(std::function<void()>) override { return false; }

StreamEncoderFilterSharedPtr handle_;
};
Expand Down Expand Up @@ -419,6 +421,7 @@ class ConnectionManagerImpl : Logger::Loggable<Logger::Id::http>,
void traceRequest();

void refreshCachedRoute();
bool requestRouteConfigUpdate(std::function<void()> cb);

// Pass on watermark callbacks to watermark subscribers. This boils down to passing watermark
// events for this stream and the downstream connection to the router filter.
Expand Down Expand Up @@ -490,6 +493,7 @@ class ConnectionManagerImpl : Logger::Loggable<Logger::Id::http>,
bool hasCachedRoute() { return cached_route_.has_value() && cached_route_.value(); }

ConnectionManagerImpl& connection_manager_;
Router::RouteConfigProvider& route_config_provider_;
Router::ConfigConstSharedPtr snapped_route_config_;
Tracing::SpanPtr active_span_;
const uint64_t stream_id_;
Expand Down
36 changes: 33 additions & 3 deletions source/common/router/rds_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ void RdsRouteConfigSubscription::onConfigUpdateFailed(const EnvoyException*) {
init_target_.ready();
}

void RdsRouteConfigSubscription::ondemandUpdate(const std::set<std::string>& aliases) {
if (vhds_subscription_.get() == nullptr) {
return;
}
vhds_subscription_->ondemandUpdate(aliases);
}

bool RdsRouteConfigSubscription::validateUpdateSize(int num_resources) {
if (num_resources == 0) {
ENVOY_LOG(debug, "Missing RouteConfiguration for {} in onConfigUpdate()", route_config_name_);
Expand All @@ -172,7 +179,8 @@ RdsRouteConfigProviderImpl::RdsRouteConfigProviderImpl(
Server::Configuration::FactoryContext& factory_context)
: subscription_(std::move(subscription)),
config_update_info_(subscription_->routeConfigUpdate()), factory_context_(factory_context),
tls_(factory_context.threadLocal().allocateSlot()) {
tls_(factory_context.threadLocal().allocateSlot()),
config_update_callbacks_(factory_context.threadLocal().allocateSlot()) {
ConfigConstSharedPtr initial_config;
if (config_update_info_->configInfo().has_value()) {
initial_config = std::make_shared<ConfigImpl>(config_update_info_->routeConfiguration(),
Expand All @@ -183,6 +191,9 @@ RdsRouteConfigProviderImpl::RdsRouteConfigProviderImpl(
tls_->set([initial_config](Event::Dispatcher&) -> ThreadLocal::ThreadLocalObjectSharedPtr {
return std::make_shared<ThreadLocalConfig>(initial_config);
});
config_update_callbacks_->set([](Event::Dispatcher&) -> ThreadLocal::ThreadLocalObjectSharedPtr {
return std::make_shared<ThreadLocalCallbacks>();
});
subscription_->routeConfigProviders().insert(this);
}

Expand All @@ -194,11 +205,30 @@ Router::ConfigConstSharedPtr RdsRouteConfigProviderImpl::config() {
return tls_->getTyped<ThreadLocalConfig>().config_;
}

bool RdsRouteConfigProviderImpl::requestVirtualHostsUpdate(const std::string& for_domain,
std::function<void()> cb) {
if (!config()->usesVhds()) {
return false;
}
factory_context_.dispatcher().post(
[this, for_domain]() -> void { subscription_->ondemandUpdate({for_domain}); });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be onDemandUpdate..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an issue of collision with Envoy callback naming, though, right? onDemandUpdate sounds like a function that handles a "demand update". Not sure that there's a good solution here, hahaha....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe updateOnDemand? lazyUpdate?

config_update_callbacks_->getTyped<ThreadLocalCallbacks>().callbacks_.push(cb);

return true;
}

void RdsRouteConfigProviderImpl::onConfigUpdate() {
ConfigConstSharedPtr new_config(
new ConfigImpl(config_update_info_->routeConfiguration(), factory_context_, false));
tls_->runOnAllThreads(
[this, new_config]() -> void { tls_->getTyped<ThreadLocalConfig>().config_ = new_config; });
tls_->runOnAllThreads([this, new_config]() -> void {
tls_->getTyped<ThreadLocalConfig>().config_ = new_config;
auto callbacks = config_update_callbacks_->getTyped<ThreadLocalCallbacks>().callbacks_;
if (!callbacks.empty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a while? What if there are multiple updates requested before a response is received? Do you have tests for this?

auto cb = callbacks.front();
callbacks.pop();
cb();
}
});
}

RouteConfigProviderManagerImpl::RouteConfigProviderManagerImpl(Server::Admin& admin) {
Expand Down
13 changes: 13 additions & 0 deletions source/common/router/rds_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cstdint>
#include <functional>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
Expand Down Expand Up @@ -67,6 +68,9 @@ class StaticRouteConfigProviderImpl : public RouteConfigProvider {
}
SystemTime lastUpdated() const override { return last_updated_; }
void onConfigUpdate() override {}
bool requestVirtualHostsUpdate(const std::string&, std::function<void()>) override {
return false;
}

private:
ConfigConstSharedPtr config_;
Expand Down Expand Up @@ -108,6 +112,7 @@ class RdsRouteConfigSubscription : Envoy::Config::SubscriptionCallbacks,
}
RouteConfigUpdatePtr& routeConfigUpdate() { return config_update_info_; }

void ondemandUpdate(const std::set<std::string>& aliases);
// Config::SubscriptionCallbacks
void onConfigUpdate(const Protobuf::RepeatedPtrField<ProtobufWkt::Any>& resources,
const std::string& version_info) override;
Expand Down Expand Up @@ -146,6 +151,10 @@ class RdsRouteConfigSubscription : Envoy::Config::SubscriptionCallbacks,

using RdsRouteConfigSubscriptionSharedPtr = std::shared_ptr<RdsRouteConfigSubscription>;

struct ThreadLocalCallbacks : public ThreadLocal::ThreadLocalObject {
std::queue<std::function<void()>> callbacks_;
};

/**
* Implementation of RouteConfigProvider that fetches the route configuration dynamically using
* the subscription.
Expand All @@ -157,6 +166,7 @@ class RdsRouteConfigProviderImpl : public RouteConfigProvider,

RdsRouteConfigSubscription& subscription() { return *subscription_; }
void onConfigUpdate() override;
bool requestVirtualHostsUpdate(const std::string& for_domain, std::function<void()> cb) override;

// Router::RouteConfigProvider
Router::ConfigConstSharedPtr config() override;
Expand All @@ -174,10 +184,13 @@ class RdsRouteConfigProviderImpl : public RouteConfigProvider,
RdsRouteConfigProviderImpl(RdsRouteConfigSubscriptionSharedPtr&& subscription,
Server::Configuration::FactoryContext& factory_context);

void addConfigUpdateCallback(std::function<void()> cb);

RdsRouteConfigSubscriptionSharedPtr subscription_;
RouteConfigUpdatePtr& config_update_info_;
Server::Configuration::FactoryContext& factory_context_;
ThreadLocal::SlotPtr tls_;
ThreadLocal::SlotPtr config_update_callbacks_;

friend class RouteConfigProviderManagerImpl;
};
Expand Down
14 changes: 14 additions & 0 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,20 @@ Http::FilterHeadersStatus Filter::decodeHeaders(Http::HeaderMap& headers, bool e
// Determine if there is a route entry or a direct response for the request.
route_ = callbacks_->route();
if (!route_) {
/*
attempting_internal_redirect_with_complete_stream_ = true;
// upstream_request_->upstream_timing_.last_upstream_rx_byte_received_ &&
downstream_end_stream_;

if (//downstream_end_stream_ &&
!callbacks_->decodingBuffer() && // Redirects with body not yet supported.
callbacks_->recreateStream()) {
//cluster_->stats().upstream_internal_redirect_succeeded_total_.inc();
return Http::FilterHeadersStatus::StopIteration;
}

attempting_internal_redirect_with_complete_stream_ = false;
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

config_.stats_.no_route_.inc();
ENVOY_STREAM_LOG(debug, "no cluster match for URL '{}'", *callbacks_,
headers.Path()->value().getStringView());
Expand Down
Loading