Skip to content

Commit

Permalink
patch: Adjust the custom patch
Browse files Browse the repository at this point in the history
Signed-off-by: Tam Mach <tam.mach@cilium.io>
  • Loading branch information
sayboras committed Oct 22, 2023
1 parent 7634280 commit 66d0e9d
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ the readDisable() calls on the downstream connection.
Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>

diff --git a/source/common/tcp_proxy/BUILD b/source/common/tcp_proxy/BUILD
index db2c5b1895..94a36240ad 100644
index 07d5c5995d..75f9047969 100644
--- a/source/common/tcp_proxy/BUILD
+++ b/source/common/tcp_proxy/BUILD
@@ -50,6 +50,7 @@ envoy_cc_library(
@@ -51,6 +51,7 @@ envoy_cc_library(
"//envoy/stats:stats_interface",
"//envoy/stats:stats_macros",
"//envoy/stats:timespan_interface",
Expand All @@ -43,18 +43,18 @@ index db2c5b1895..94a36240ad 100644
"//envoy/tcp:conn_pool_interface",
"//envoy/tcp:upstream_interface",
diff --git a/source/common/tcp_proxy/tcp_proxy.cc b/source/common/tcp_proxy/tcp_proxy.cc
index f40b5bdb2d..b74695f45a 100644
index 16afd76f5b..858f15d9f6 100644
--- a/source/common/tcp_proxy/tcp_proxy.cc
+++ b/source/common/tcp_proxy/tcp_proxy.cc
@@ -12,6 +12,7 @@
#include "envoy/extensions/filters/network/tcp_proxy/v3/tcp_proxy.pb.h"
@@ -13,6 +13,7 @@
#include "envoy/extensions/filters/network/tcp_proxy/v3/tcp_proxy.pb.validate.h"
#include "envoy/registry/registry.h"
#include "envoy/stats/scope.h"
+#include "envoy/stream_info/bool_accessor.h"
#include "envoy/upstream/cluster_manager.h"
#include "envoy/upstream/upstream.h"

@@ -244,7 +245,17 @@ void Filter::initialize(Network::ReadFilterCallbacks& callbacks, bool set_connec
@@ -256,7 +257,17 @@ void Filter::initialize(Network::ReadFilterCallbacks& callbacks, bool set_connec
// Need to disable reads so that we don't write to an upstream that might fail
// in onData(). This will get re-enabled when the upstream connection is
// established.
Expand All @@ -73,7 +73,7 @@ index f40b5bdb2d..b74695f45a 100644
getStreamInfo().setDownstreamBytesMeter(std::make_shared<StreamInfo::BytesMeter>());
getStreamInfo().setUpstreamInfo(std::make_shared<StreamInfo::UpstreamInfoImpl>());

@@ -467,8 +478,11 @@ Network::FilterStatus Filter::establishUpstreamConnection() {
@@ -479,8 +490,11 @@ Network::FilterStatus Filter::establishUpstreamConnection() {
// cluster->trafficStats()->upstream_cx_none_healthy in the latter case.
getStreamInfo().setResponseFlag(StreamInfo::ResponseFlag::NoHealthyUpstream);
onInitFailure(UpstreamFailureReason::NoHealthyUpstream);
Expand All @@ -86,7 +86,7 @@ index f40b5bdb2d..b74695f45a 100644
}

void Filter::onClusterDiscoveryCompletion(Upstream::ClusterDiscoveryStatus cluster_status) {
@@ -683,12 +697,18 @@ Network::FilterStatus Filter::onData(Buffer::Instance& data, bool end_stream) {
@@ -692,12 +706,18 @@ Network::FilterStatus Filter::onData(Buffer::Instance& data, bool end_stream) {
if (upstream_) {
getStreamInfo().getUpstreamBytesMeter()->addWireBytesSent(data.length());
upstream_->encodeData(data, end_stream);
Expand All @@ -106,7 +106,7 @@ index f40b5bdb2d..b74695f45a 100644
return Network::FilterStatus::StopIteration;
}

@@ -803,7 +823,13 @@ void Filter::onUpstreamConnection() {
@@ -814,7 +834,13 @@ void Filter::onUpstreamConnection() {
connecting_ = false;
// Re-enable downstream reads now that the upstream connection is established
// so we have a place to send downstream data to.
Expand All @@ -122,7 +122,7 @@ index f40b5bdb2d..b74695f45a 100644
read_callbacks_->upstreamHost()->outlierDetector().putResult(
Upstream::Outlier::Result::LocalOriginConnectSuccessFinal);
diff --git a/source/common/tcp_proxy/tcp_proxy.h b/source/common/tcp_proxy/tcp_proxy.h
index 6abaea2f6c..72c28f2bfe 100644
index 41697d2f0d..41f02eaf51 100644
--- a/source/common/tcp_proxy/tcp_proxy.h
+++ b/source/common/tcp_proxy/tcp_proxy.h
@@ -22,6 +22,7 @@
Expand All @@ -142,7 +142,7 @@ index 6abaea2f6c..72c28f2bfe 100644
/**
* All tcp proxy stats. @see stats_macros.h
*/
@@ -541,6 +544,9 @@ protected:
@@ -546,6 +549,9 @@ protected:
uint32_t connect_attempts_{};
bool connecting_{};
bool downstream_closed_{};
Expand All @@ -153,10 +153,10 @@ index 6abaea2f6c..72c28f2bfe 100644

// This class deals with an upstream connection that needs to finish flushing, when the downstream
diff --git a/test/integration/BUILD b/test/integration/BUILD
index 257fde93a7..08cdf45535 100644
index 6b33bb785b..058025c829 100644
--- a/test/integration/BUILD
+++ b/test/integration/BUILD
@@ -1665,6 +1665,7 @@ envoy_cc_test(
@@ -1755,6 +1755,7 @@ envoy_cc_test(
"//source/common/event:dispatcher_includes",
"//source/common/event:dispatcher_lib",
"//source/common/network:utility_lib",
Expand All @@ -165,7 +165,7 @@ index 257fde93a7..08cdf45535 100644
"//source/extensions/filters/network/common:factory_base_lib",
"//source/extensions/filters/network/tcp_proxy:config",
diff --git a/test/integration/tcp_proxy_integration_test.cc b/test/integration/tcp_proxy_integration_test.cc
index f88cf9a62f..d13f9d2aef 100644
index 8445d2f762..6ebeab02b2 100644
--- a/test/integration/tcp_proxy_integration_test.cc
+++ b/test/integration/tcp_proxy_integration_test.cc
@@ -12,6 +12,8 @@
Expand All @@ -177,7 +177,7 @@ index f88cf9a62f..d13f9d2aef 100644
#include "source/extensions/filters/network/common/factory_base.h"
#include "source/extensions/transport_sockets/tls/context_manager_impl.h"

@@ -1259,18 +1261,27 @@ public:
@@ -1258,18 +1260,27 @@ public:
Network::FilterStatus onData(Buffer::Instance& data, bool) override {
if (!metadata_set_) {
// To allow testing a write that returns `StopIteration`, only proceed
Expand Down Expand Up @@ -213,7 +213,7 @@ index f88cf9a62f..d13f9d2aef 100644

ProtobufWkt::Struct& map =
(*read_callbacks_->connection()
@@ -1279,24 +1290,25 @@ public:
@@ -1278,24 +1289,25 @@ public:
.mutable_filter_metadata())[Envoy::Config::MetadataFilters::get().ENVOY_LB];
(*map.mutable_fields())[key_] = val;

Expand Down Expand Up @@ -245,7 +245,7 @@ index f88cf9a62f..d13f9d2aef 100644
}

const std::string key_;
@@ -1354,14 +1366,25 @@ TEST_P(TcpProxyDynamicMetadataMatchIntegrationTest, DynamicMetadataMatch) {
@@ -1353,14 +1365,25 @@ TEST_P(TcpProxyDynamicMetadataMatchIntegrationTest, DynamicMetadataMatch) {
initialize();

expectEndpointToMatchRoute([](IntegrationTcpClient& tcp_client) -> std::string {
Expand Down Expand Up @@ -278,7 +278,7 @@ index f88cf9a62f..d13f9d2aef 100644
});
}

@@ -1378,7 +1401,7 @@ TEST_P(TcpProxyDynamicMetadataMatchIntegrationTest, DynamicMetadataNonMatch) {
@@ -1377,7 +1400,7 @@ TEST_P(TcpProxyDynamicMetadataMatchIntegrationTest, DynamicMetadataNonMatch) {

initialize();

Expand All @@ -288,5 +288,5 @@ index f88cf9a62f..d13f9d2aef 100644

INSTANTIATE_TEST_SUITE_P(TcpProxyIntegrationTestParams, TcpProxySslIntegrationTest,
--
2.41.0
2.39.2

0 comments on commit 66d0e9d

Please sign in to comment.