Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions api/envoy/config/cluster/v3/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ message Cluster {
EdsClusterConfig eds_cluster_config = 3;

// The timeout for new network connections to hosts in the cluster.
// If not set, a default value of 5s will be used.
google.protobuf.Duration connect_timeout = 4 [(validate.rules).duration = {gt {}}];

// Soft limit on size of the cluster’s connections read and write buffers. If
Expand Down
1 change: 1 addition & 0 deletions api/envoy/config/cluster/v4alpha/cluster.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/root/faq/configuration/timeouts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ TCP
---

* The cluster :ref:`connect_timeout <envoy_v3_api_field_config.cluster.v3.Cluster.connect_timeout>` specifies the amount
of time Envoy will wait for an upstream TCP connection to be established. This timeout has no
default, but is required in the configuration.
of time Envoy will wait for an upstream TCP connection to be established. If this value is not set,
a default value of 5 seconds will be used.

.. attention::

Expand Down
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Minor Behavior Changes
requests to S3, ES or Glacier, which used the literal string ``UNSIGNED-PAYLOAD``. Buffering can
be now be disabled in favor of using unsigned payloads with compatible services via the new
`use_unsigned_payload` filter option (default false).
* cluster: added default value of 5 seconds for :ref:`connect_timeout <envoy_v3_api_field_config.cluster.v3.Cluster.connect_timeout>`.
* http: disable the integration between :ref:`ExtensionWithMatcher <envoy_v3_api_msg_extensions.common.matching.v3.ExtensionWithMatcher>`
and HTTP filters by default to reflects its experimental status. This feature can be enabled by seting
``envoy.reloadable_features.experimental_matching_api`` to true.
Expand Down
1 change: 1 addition & 0 deletions generated_api_shadow/envoy/config/cluster/v3/cluster.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/common/upstream/upstream_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ ClusterInfoImpl::ClusterInfoImpl(
runtime_.snapshot().getInteger(Http::MaxResponseHeadersCountOverrideKey,
Http::DEFAULT_MAX_HEADERS_COUNT))),
connect_timeout_(
std::chrono::milliseconds(PROTOBUF_GET_MS_REQUIRED(config, connect_timeout))),
std::chrono::milliseconds(PROTOBUF_GET_MS_OR_DEFAULT(config, connect_timeout, 5000))),
per_upstream_preconnect_ratio_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(
config.preconnect_policy(), per_upstream_preconnect_ratio, 1.0)),
peekahead_ratio_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(config.preconnect_policy(),
Expand Down
14 changes: 14 additions & 0 deletions test/common/upstream/upstream_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2612,6 +2612,20 @@ TEST_F(ClusterInfoImplTest, TestTrackRemainingResourcesGauges) {
EXPECT_EQ(4U, high_remaining_retries.value());
}

TEST_F(ClusterInfoImplTest, DefaultConnectTimeout) {
const std::string yaml = R"EOF(
name: cluster1
type: STRICT_DNS
lb_policy: ROUND_ROBIN
)EOF";

auto cluster = makeCluster(yaml);
envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml);

EXPECT_FALSE(cluster_config.has_connect_timeout());
EXPECT_EQ(std::chrono::seconds(5), cluster->info()->connectTimeout());
}

TEST_F(ClusterInfoImplTest, Timeouts) {
const std::string yaml = R"EOF(
name: name
Expand Down