envoy icon indicating copy to clipboard operation
envoy copied to clipboard

Support WaitForWarmOnInit for EDS clusters

Open belyalov opened this issue 1 year ago • 0 comments

Support WaitForWarmOnInit for EDS clusters

Description: Currently it states that it is not supported:

Optional configuration for having cluster readiness block on warm-up. Currently, only applicable for
:ref:`STRICT_DNS<envoy_v3_api_enum_value_config.cluster.v3.Cluster.DiscoveryType.STRICT_DNS>`,
or :ref:`LOGICAL_DNS<envoy_v3_api_enum_value_config.cluster.v3.Cluster.DiscoveryType.LOGICAL_DNS>`,
or :ref:`Redis Cluster<arch_overview_redis>`.
If true, cluster readiness blocks on warm-up. If false, the cluster will complete
initialization whether or not warm-up has completed. Defaults to true.

Is there any reason why it is not supported? In forward proxy use case it is beneficial to start envoy as soon as possible to start handling traffic while continuing to initialize other clusters with e.g. active health checks.

It looks like the support is straightforward to add, e.g.

diff --git a/source/extensions/clusters/eds/eds.cc b/source/extensions/clusters/eds/eds.cc
index bfb6670846..9220ab069f 100644
--- a/source/extensions/clusters/eds/eds.cc
+++ b/source/extensions/clusters/eds/eds.cc
@@ -46,7 +46,12 @@ EdsClusterImpl::~EdsClusterImpl() {
   }
 }
 
-void EdsClusterImpl::startPreInit() { subscription_->start({edsServiceName()}); }
+void EdsClusterImpl::startPreInit() {
+  subscription_->start({edsServiceName()});
+  if (!wait_for_warm_on_init_) {
+    onPreInitComplete();
+  }
+}
 
 void EdsClusterImpl::BatchUpdateHelper::batchUpdate(PrioritySet::HostUpdateCb& host_update_cb) {
   absl::flat_hash_set<std::string> all_new_hosts;

Is this something worth to add?

belyalov avatar Feb 22 '24 22:02 belyalov