@@ -415,7 +415,7 @@ ClusterImplBase::ClusterImplBase(const envoy::api::v2::Cluster& cluster,
415415 Ssl::ContextManager& ssl_context_manager, bool added_via_api)
416416 : runtime_(runtime), info_(new ClusterInfoImpl(cluster, bind_config, runtime, stats,
417417 ssl_context_manager, added_via_api)),
418- endpoints_(cluster.endpoints()) {
418+ endpoints_(cluster.endpoints().lb_endpoints() ) {
419419 // Create the default (empty) priority set before registering callbacks to
420420 // avoid getting an update the first time it is accessed.
421421 priority_set_.getOrCreateHostSet (0 );
@@ -447,8 +447,8 @@ void ClusterImplBase::translateClusterHosts(
447447
448448 endpoints_.Reserve (hosts.size ());
449449 for (const envoy::api::v2::core::Address& host : hosts) {
450- envoy::api::v2::endpoint::Endpoint* endpoint = endpoints_.Add ();
451- endpoint ->mutable_address ()->CopyFrom (host);
450+ envoy::api::v2::endpoint::LbEndpoint* lb_endpoint = endpoints_.Add ();
451+ lb_endpoint-> mutable_endpoint () ->mutable_address ()->CopyFrom (host);
452452 }
453453}
454454
@@ -641,10 +641,11 @@ StaticClusterImpl::StaticClusterImpl(const envoy::api::v2::Cluster& cluster,
641641 bool added_via_api)
642642 : ClusterImplBase(cluster, cm.bindConfig(), runtime, stats, ssl_context_manager, added_via_api),
643643 initial_hosts_(new HostVector()) {
644- for (const auto & endpoint : endpoints_) {
645- const auto & host = endpoint. address ();
644+ for (const envoy::api::v2::endpoint::LbEndpoint& lb_endpoint : endpoints_) {
645+ const envoy::api::v2::endpoint::Endpoint& endpoint = lb_endpoint. endpoint ();
646646 initial_hosts_->emplace_back (HostSharedPtr{new HostImpl (
647- info_, " " , resolveProtoAddress (host), envoy::api::v2::core::Metadata::default_instance (), 1 ,
647+ info_, EMPTY_STRING, resolveProtoAddress (endpoint.address ()),
648+ envoy::api::v2::core::Metadata::default_instance (), 1 ,
648649 envoy::api::v2::core::Locality ().default_instance (), endpoint.health_check_config ())});
649650 }
650651}
@@ -807,13 +808,13 @@ StrictDnsClusterImpl::StrictDnsClusterImpl(const envoy::api::v2::Cluster& cluste
807808 NOT_REACHED;
808809 }
809810
810- for (const auto & endpoint : endpoints_) {
811- const auto & host = endpoint. address ();
812- resolve_targets_. emplace_back (
813- new ResolveTarget (* this , dispatcher,
814- fmt::format ( " tcp://{}:{} " , host. socket_address (). address () ,
815- host. socket_address () .port_value ()),
816- endpoint.health_check_config ()));
811+ for (const envoy::api::v2::endpoint::LbEndpoint& lb_endpoint : endpoints_) {
812+ const envoy::api::v2::core::SocketAddress& socket_address =
813+ lb_endpoint. endpoint (). address (). socket_address ();
814+ resolve_targets_. emplace_back ( new ResolveTarget (
815+ * this , dispatcher ,
816+ fmt::format ( " tcp://{}:{} " , socket_address. address (), socket_address .port_value ()),
817+ lb_endpoint. endpoint () .health_check_config ()));
817818 }
818819}
819820
0 commit comments