Skip to content

Commit aaaa646

Browse files
authored
Merge pull request #296 from jwendell/sync1
Sync with upstream
2 parents bc44aad + a2c572c commit aaaa646

File tree

20 files changed

+138
-45
lines changed

20 files changed

+138
-45
lines changed

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.32.3
1+
1.32.4-dev

changelogs/1.32.3.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
date: December 18, 2024
2+
3+
bug_fixes:
4+
- area: http/1
5+
change: |
6+
Fixes sending overload crashes when HTTP/1 request is reset.
7+
- area: happy_eyeballs
8+
change: |
9+
Validate that ``additional_address`` are IP addresses instead of crashing when sorting.
10+
- area: balsa
11+
change: |
12+
Fix incorrect handling of non-101 1xx responses. This fix can be temporarily reverted by setting runtime guard
13+
``envoy.reloadable_features.wait_for_first_byte_before_balsa_msg_done`` to false.

changelogs/current.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
date: December 18, 2024
1+
date: Pending
2+
3+
behavior_changes:
4+
# *Changes that are expected to cause an incompatibility if applicable; deployment changes are likely required*
5+
6+
minor_behavior_changes:
7+
# *Changes that may cause incompatibilities for some users, but should not for most*
8+
- area: rds
9+
change: |
10+
When a new RDS provider config is pushed via xDS and the only difference is change to
11+
:ref:`initial_fetch_timeout <envoy_v3_api_field_config.core.v3.ConfigSource.initial_fetch_timeout>`,
12+
the already existing provider will be reused. Envoy will not ask RDS server for routes
13+
config because existing provider already has up to date routes config.
14+
This behavioral change can be enabled by setting runtime guard
15+
``envoy.reloadable_features.normalize_rds_provider_config`` to true.
216
317
bug_fixes:
418
- area: http/1

ci/Dockerfile-envoy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ COPY --chown=0:0 --chmod=755 \
5959

6060

6161
# STAGE: envoy-distroless
62-
FROM gcr.io/distroless/base-nossl-debian12:nonroot@sha256:2a803cc873dc1a69a33087ee10c75755367dd2c259219893504680480ad563f0 AS envoy-distroless
62+
FROM gcr.io/distroless/base-nossl-debian12:nonroot@sha256:e9554da0d9569cfa21023ee8d2624d7326d80791b49b7c71b08a8b4e8d206129 AS envoy-distroless
6363
EXPOSE 10000
6464
ENTRYPOINT ["/usr/local/bin/envoy"]
6565
CMD ["-c", "/etc/envoy/envoy.yaml"]

docs/root/configuration/http/http_filters/lua_filter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ Or, through ``bodyChunks()`` API, which let Envoy to skip buffering the upstream
278278
Complete example
279279
----------------
280280

281-
A complete example using Docker is available in :repo:`/examples/lua`.
281+
A complete example using Docker is available in `here <https://github.com/envoyproxy/examples/tree/main/lua>`__.
282282

283283
Stream handle API
284284
-----------------

source/common/rds/route_config_provider_manager.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,6 @@ RouteConfigProviderPtr RouteConfigProviderManager::addStaticProvider(
7575
return provider;
7676
}
7777

78-
RouteConfigProviderSharedPtr RouteConfigProviderManager::addDynamicProvider(
79-
const Protobuf::Message& rds, const std::string& route_config_name, Init::Manager& init_manager,
80-
std::function<
81-
std::pair<RouteConfigProviderSharedPtr, const Init::Target*>(uint64_t manager_identifier)>
82-
create_dynamic_provider) {
83-
// RdsRouteConfigSubscriptions are unique based on their serialized RDS config.
84-
const uint64_t manager_identifier = MessageUtil::hash(rds);
85-
auto existing_provider =
86-
reuseDynamicProvider(manager_identifier, init_manager, route_config_name);
87-
88-
if (existing_provider) {
89-
return existing_provider;
90-
}
91-
auto new_provider = create_dynamic_provider(manager_identifier);
92-
init_manager.add(*new_provider.second);
93-
dynamic_route_config_providers_.insert({manager_identifier, new_provider});
94-
return new_provider.first;
95-
}
96-
9778
RouteConfigProviderSharedPtr
9879
RouteConfigProviderManager::reuseDynamicProvider(uint64_t manager_identifier,
9980
Init::Manager& init_manager,

source/common/rds/route_config_provider_manager.h

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "source/common/common/matchers.h"
1414
#include "source/common/protobuf/utility.h"
15+
#include "source/common/runtime/runtime_features.h"
1516

1617
#include "absl/container/node_hash_map.h"
1718
#include "absl/container/node_hash_set.h"
@@ -34,12 +35,43 @@ class RouteConfigProviderManager {
3435

3536
RouteConfigProviderPtr
3637
addStaticProvider(std::function<RouteConfigProviderPtr()> create_static_provider);
38+
39+
template <class RdsConfig>
3740
RouteConfigProviderSharedPtr
38-
addDynamicProvider(const Protobuf::Message& rds, const std::string& route_config_name,
41+
addDynamicProvider(const RdsConfig& rds, const std::string& route_config_name,
3942
Init::Manager& init_manager,
4043
std::function<std::pair<RouteConfigProviderSharedPtr, const Init::Target*>(
4144
uint64_t manager_identifier)>
42-
create_dynamic_provider);
45+
create_dynamic_provider) {
46+
47+
uint64_t manager_identifier;
48+
49+
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.normalize_rds_provider_config")) {
50+
// Normalize the config_source part of the passed config. Some parts of the config_source
51+
// do not affect selection of the RDS provider. They will be cleared (zeroed) and restored
52+
// after calculating hash.
53+
// Since rds is passed as const, the constness must be casted away before modifying rds.
54+
auto* orig_initial_timeout =
55+
const_cast<RdsConfig&>(rds).mutable_config_source()->release_initial_fetch_timeout();
56+
manager_identifier = MessageUtil::hash(rds);
57+
const_cast<RdsConfig&>(rds).mutable_config_source()->set_allocated_initial_fetch_timeout(
58+
orig_initial_timeout);
59+
60+
} else {
61+
manager_identifier = MessageUtil::hash(rds);
62+
}
63+
64+
auto existing_provider =
65+
reuseDynamicProvider(manager_identifier, init_manager, route_config_name);
66+
67+
if (existing_provider) {
68+
return existing_provider;
69+
}
70+
auto new_provider = create_dynamic_provider(manager_identifier);
71+
init_manager.add(*new_provider.second);
72+
dynamic_route_config_providers_.insert({manager_identifier, new_provider});
73+
return new_provider.first;
74+
}
4375

4476
private:
4577
// TODO(jsedgwick) These two members are prime candidates for the owned-entry list/map

source/common/runtime/runtime_features.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ FALSE_RUNTIME_GUARD(envoy_reloadable_features_logging_with_fast_json_formatter);
171171
// Controls whether a stream stays open when HTTP/2 or HTTP/3 upstream half closes
172172
// before downstream.
173173
FALSE_RUNTIME_GUARD(envoy_reloadable_features_allow_multiplexed_upstream_half_close);
174+
// A flag to enable normalization of RDS provider config. (see PR 37180).
175+
FALSE_RUNTIME_GUARD(envoy_reloadable_features_normalize_rds_provider_config);
174176

175177
// Block of non-boolean flags. Use of int flags is deprecated. Do not add more.
176178
ABSL_FLAG(uint64_t, re2_max_program_size_error_level, 100, ""); // NOLINT

test/common/api/os_sys_calls_test.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ TEST(OsSyscallsTest, OpenPwritePreadFstatCloseStatUnlink) {
6969
}
7070

7171
TEST(OsSyscallsTest, SupportsIpTransparent) {
72-
bool supported = Api::OsSysCallsSingleton::get().supportsIpTransparent(
73-
TestEnvironment::getIpVersionsForTest()[0]);
74-
EXPECT_FALSE(supported);
72+
// Some environments support this and some don't; just call the function to make sure nothing
73+
// dire (like a crash) happens, without validating the return value.
74+
Api::OsSysCallsSingleton::get().supportsIpTransparent(TestEnvironment::getIpVersionsForTest()[0]);
7575
}
7676

7777
TEST(OsSyscallsTest, SupportsMptcp) {
78-
bool supported = Api::OsSysCallsSingleton::get().supportsMptcp();
79-
EXPECT_TRUE(supported);
78+
// Some environments support this and some don't; just call the function to make sure nothing
79+
// dire (like a crash) happens, without validating the return value.
80+
Api::OsSysCallsSingleton::get().supportsMptcp();
8081
}
8182

8283
TEST(OsSyscallsTest, IoCtlInvalidFd) {

test/common/router/rds_impl_test.cc

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,55 @@ version_info: '1'
11531153
EXPECT_EQ(expected_route_config_dump.DebugString(), route_config_dump3.DebugString());
11541154
}
11551155

1156+
TEST_F(RouteConfigProviderManagerImplTest, NormalizeDynamicProviderConfig) {
1157+
setup();
1158+
1159+
const auto route_config = parseRouteConfigurationFromV3Yaml(R"EOF(
1160+
name: foo_route_config
1161+
virtual_hosts:
1162+
- name: bar
1163+
domains: ["*"]
1164+
routes:
1165+
- match: { prefix: "/" }
1166+
route: { cluster: baz }
1167+
)EOF");
1168+
const auto decoded_resources = TestUtility::decodeResources({route_config});
1169+
1170+
EXPECT_TRUE(server_factory_context_.cluster_manager_.subscription_factory_.callbacks_
1171+
->onConfigUpdate(decoded_resources.refvec_, "1")
1172+
.ok());
1173+
1174+
UniversalStringMatcher universal_name_matcher;
1175+
EXPECT_EQ(1UL, route_config_provider_manager_->dumpRouteConfigs(universal_name_matcher)
1176+
->dynamic_route_configs()
1177+
.size());
1178+
1179+
for (bool normalize_config : std::vector<bool>({true, false})) {
1180+
Runtime::maybeSetRuntimeGuard("envoy.reloadable_features.normalize_rds_provider_config",
1181+
normalize_config);
1182+
envoy::extensions::filters::network::http_connection_manager::v3::Rds rds2;
1183+
rds2 = rds_;
1184+
// The following is valid only when normalize_config is true:
1185+
// Modify parameters which should not affect the provider. In other words, the same provider
1186+
// should be picked, regardless of the fact that initial_fetch_timeout is different for both
1187+
// configs.
1188+
rds2.mutable_config_source()->mutable_initial_fetch_timeout()->set_seconds(
1189+
rds_.config_source().initial_fetch_timeout().seconds() + 1);
1190+
1191+
RouteConfigProviderSharedPtr provider2 =
1192+
route_config_provider_manager_->createRdsRouteConfigProvider(
1193+
rds2, server_factory_context_, "foo_prefix", outer_init_manager_);
1194+
1195+
EXPECT_TRUE(server_factory_context_.cluster_manager_.subscription_factory_.callbacks_
1196+
->onConfigUpdate(decoded_resources.refvec_, "provider2")
1197+
.ok());
1198+
EXPECT_EQ(normalize_config ? 1UL : 2UL,
1199+
route_config_provider_manager_->dumpRouteConfigs(universal_name_matcher)
1200+
->dynamic_route_configs()
1201+
.size());
1202+
}
1203+
}
1204+
11561205
} // namespace
11571206
} // namespace Router
11581207
} // namespace Envoy

0 commit comments

Comments
 (0)