Go to the documentation of this file.
23 #include <type_traits>
26 #include "absl/memory/memory.h"
27 #include "absl/status/status.h"
28 #include "absl/strings/str_cat.h"
29 #include "absl/strings/str_format.h"
30 #include "absl/strings/str_join.h"
67 contents.push_back(
"cluster_type=EDS");
74 contents.push_back(
"cluster_type=LOGICAL_DNS");
78 contents.push_back(
"cluster_type=AGGREGATE");
114 if (
name !=
"envoy.transport_sockets.tls") {
120 if (typed_config !=
nullptr) {
123 auto* upstream_tls_context =
125 encoded_upstream_tls_context.
data,
127 if (upstream_tls_context ==
nullptr) {
129 "Can't decode upstream tls context.");
131 auto* common_tls_context_proto =
133 upstream_tls_context);
134 if (common_tls_context_proto !=
nullptr) {
136 context, common_tls_context_proto, common_tls_context);
139 "Error parsing UpstreamTlsContext"),
147 "UpstreamTlsContext: TLS configuration provided but no "
148 "ca_certificate_provider_instance found.");
155 XdsClusterResource* cds_update) {
156 const auto* load_assignment =
158 if (load_assignment ==
nullptr) {
160 "load_assignment not present for LOGICAL_DNS cluster");
162 size_t num_localities;
163 const auto*
const* localities =
166 if (num_localities != 1) {
168 absl::StrCat(
"load_assignment for LOGICAL_DNS cluster must have "
169 "exactly one locality, found ",
172 size_t num_endpoints;
173 const auto*
const* endpoints =
176 if (num_endpoints != 1) {
178 absl::StrCat(
"locality for LOGICAL_DNS cluster must have "
179 "exactly one endpoint, found ",
182 const auto* endpoint =
184 if (endpoint ==
nullptr) {
186 "LbEndpoint endpoint field not set");
189 if (address ==
nullptr) {
191 "Endpoint address field not set");
193 const auto* socket_address =
195 if (socket_address ==
nullptr) {
197 "Address socket_address field not set");
202 "LOGICAL_DNS clusters must NOT have a custom resolver name set");
206 if (address_str.
empty()) {
208 "SocketAddress address field not set");
212 "SocketAddress port_value field not set");
221 const XdsEncodingContext&
context,
223 XdsClusterResource* cds_update) {
224 std::vector<grpc_error_handle>
errors;
232 cds_update->cluster_type = XdsClusterResource::ClusterType::EDS;
242 "EDS ConfigSource is not ADS or SELF."));
248 if (service_name.
size != 0) {
253 cds_update->cluster_type = XdsClusterResource::ClusterType::LOGICAL_DNS;
262 custom_cluster_type =
266 custom_cluster_type);
269 "DiscoveryType is not valid."));
271 cds_update->cluster_type = XdsClusterResource::ClusterType::AGGREGATE;
275 custom_cluster_type);
279 aggregate_cluster_config =
281 aggregate_cluster_config_upb_stringview.
data,
282 aggregate_cluster_config_upb_stringview.
size,
284 if (aggregate_cluster_config ==
nullptr) {
286 "Can't parse aggregate cluster."));
291 aggregate_cluster_config, &
size);
292 for (
size_t i = 0;
i <
size; ++
i) {
294 cds_update->prioritized_cluster_names.emplace_back(
304 cds_update->lb_policy =
"ROUND_ROBIN";
307 cds_update->lb_policy =
"RING_HASH";
309 auto* ring_hash_config =
311 if (ring_hash_config !=
nullptr) {
315 if (max_ring_size !=
nullptr) {
316 cds_update->max_ring_size =
318 if (cds_update->max_ring_size > 8388608 ||
319 cds_update->max_ring_size == 0) {
321 "max_ring_size is not in the range of 1 to 8388608."));
327 if (min_ring_size !=
nullptr) {
328 cds_update->min_ring_size =
330 if (cds_update->min_ring_size > 8388608 ||
331 cds_update->min_ring_size == 0) {
333 "min_ring_size is not in the range of 1 to 8388608."));
335 if (cds_update->min_ring_size > cds_update->max_ring_size) {
337 "min_ring_size cannot be greater than max_ring_size."));
344 "ring hash lb config has invalid hash function."));
351 auto* transport_socket =
353 if (transport_socket !=
nullptr) {
355 context, transport_socket, &cds_update->common_tls_context);
359 "Error parsing security configuration"),
366 if (lrs_server !=
nullptr) {
369 ": LRS ConfigSource is not self."));
371 cds_update->lrs_load_reporting_server.emplace(
context.server);
380 size_t num_thresholds;
383 circuit_breakers, &num_thresholds);
384 for (
size_t i = 0;
i < num_thresholds; ++
i) {
385 const auto* threshold = thresholds[
i];
391 if (max_requests !=
nullptr) {
392 cds_update->max_concurrent_requests =
406 OutlierDetectionConfig outlier_detection_update;
411 if (duration !=
nullptr) {
416 if (duration !=
nullptr) {
417 outlier_detection_update.base_ejection_time =
ParseDuration(duration);
421 if (duration !=
nullptr) {
422 outlier_detection_update.max_ejection_time =
ParseDuration(duration);
427 if (max_ejection_percent !=
nullptr) {
428 outlier_detection_update.max_ejection_percent =
434 if (enforcing_success_rate !=
nullptr) {
437 if (enforcement_percentage != 0) {
438 OutlierDetectionConfig::SuccessRateEjection success_rate_ejection;
439 success_rate_ejection.enforcement_percentage = enforcement_percentage;
443 if (minimum_hosts !=
nullptr) {
444 success_rate_ejection.minimum_hosts =
450 if (request_volume !=
nullptr) {
451 success_rate_ejection.request_volume =
457 if (stdev_factor !=
nullptr) {
458 success_rate_ejection.stdev_factor =
461 outlier_detection_update.success_rate_ejection = success_rate_ejection;
467 if (enforcing_failure_percentage !=
nullptr) {
470 if (enforcement_percentage != 0) {
471 OutlierDetectionConfig::FailurePercentageEjection
472 failure_percentage_ejection;
473 failure_percentage_ejection.enforcement_percentage =
474 enforcement_percentage;
478 if (minimum_hosts !=
nullptr) {
479 failure_percentage_ejection.minimum_hosts =
485 if (request_volume !=
nullptr) {
486 failure_percentage_ejection.request_volume =
492 if (threshold !=
nullptr) {
493 failure_percentage_ejection.threshold =
496 outlier_detection_update.failure_percentage_ejection =
497 failure_percentage_ejection;
500 cds_update->outlier_detection = outlier_detection_update;
505 void MaybeLogCluster(
const XdsEncodingContext&
context,
524 serialized_resource.
data(), serialized_resource.
size(),
context.arena);
525 if (resource ==
nullptr) {
528 MaybeLogCluster(
context, resource);
533 auto cluster_data = absl::make_unique<ResourceDataSubclass>();
535 CdsResourceParse(
context, resource, is_v2, &cluster_data->resource);
547 result.name.c_str(), cluster_data->resource.ToString().c_str());
UPB_INLINE const struct google_protobuf_UInt64Value * envoy_config_cluster_v3_Cluster_RingHashLbConfig_minimum_ring_size(const envoy_config_cluster_v3_Cluster_RingHashLbConfig *msg)
Status InvalidArgumentError(absl::string_view message)
UPB_INLINE bool envoy_config_cluster_v3_Cluster_has_circuit_breakers(const envoy_config_cluster_v3_Cluster *msg)
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_failure_percentage_threshold(const envoy_config_cluster_v3_OutlierDetection *msg)
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_CircuitBreakers_Thresholds_max_requests(const envoy_config_cluster_v3_CircuitBreakers_Thresholds *msg)
UPB_INLINE envoy_extensions_clusters_aggregate_v3_ClusterConfig * envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(const char *buf, size_t size, upb_Arena *arena)
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
@ envoy_config_cluster_v3_Cluster_EDS
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
@ envoy_config_cluster_v3_Cluster_RING_HASH
GPRAPI void GPRAPI int gpr_should_log(gpr_log_severity severity)
UPB_INLINE const struct envoy_config_endpoint_v3_LocalityLbEndpoints *const * envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(const envoy_config_endpoint_v3_ClusterLoadAssignment *msg, size_t *len)
UPB_INLINE const struct google_protobuf_Duration * envoy_config_cluster_v3_OutlierDetection_base_ejection_time(const envoy_config_cluster_v3_OutlierDetection *msg)
UPB_INLINE const struct envoy_config_core_v3_TransportSocket * envoy_config_cluster_v3_Cluster_transport_socket(const envoy_config_cluster_v3_Cluster *msg)
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_success_rate_stdev_factor(const envoy_config_cluster_v3_OutlierDetection *msg)
UPB_INLINE int32_t envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(const envoy_config_cluster_v3_Cluster_RingHashLbConfig *msg)
UPB_INLINE const struct google_protobuf_Any * envoy_config_core_v3_TransportSocket_typed_config(const envoy_config_core_v3_TransportSocket *msg)
std::string eds_service_name
UPB_INLINE const struct google_protobuf_Duration * envoy_config_cluster_v3_OutlierDetection_interval(const envoy_config_cluster_v3_OutlierDetection *msg)
std::string ToString() const
UPB_INLINE bool envoy_config_core_v3_SocketAddress_has_port_value(const envoy_config_core_v3_SocketAddress *msg)
struct envoy_config_cluster_v3_Cluster_EdsClusterConfig envoy_config_cluster_v3_Cluster_EdsClusterConfig
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_failure_percentage_minimum_hosts(const envoy_config_cluster_v3_OutlierDetection *msg)
@ envoy_config_core_v3_DEFAULT
bool XdsOutlierDetectionEnabled()
UPB_INLINE uint32_t envoy_config_core_v3_SocketAddress_port_value(const envoy_config_core_v3_SocketAddress *msg)
UPB_INLINE envoy_config_cluster_v3_Cluster * envoy_config_cluster_v3_Cluster_parse(const char *buf, size_t size, upb_Arena *arena)
struct envoy_config_cluster_v3_OutlierDetection envoy_config_cluster_v3_OutlierDetection
const UPB_INLINE envoy_config_endpoint_v3_LbEndpoint *const * envoy_config_endpoint_v3_LocalityLbEndpoints_lb_endpoints(const envoy_config_endpoint_v3_LocalityLbEndpoints *msg, size_t *len)
struct envoy_config_cluster_v3_CircuitBreakers envoy_config_cluster_v3_CircuitBreakers
UPB_INLINE envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext * envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_parse(const char *buf, size_t size, upb_Arena *arena)
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_max_ejection_percent(const envoy_config_cluster_v3_OutlierDetection *msg)
#define GRPC_TRACE_FLAG_ENABLED(f)
#define GRPC_ERROR_CREATE_FROM_VECTOR(desc, error_list)
std::string UpbStringToStdString(const upb_StringView &str)
struct google_protobuf_Any google_protobuf_Any
@ envoy_config_cluster_v3_Cluster_ROUND_ROBIN
UPB_INLINE bool envoy_config_cluster_v3_Cluster_has_cluster_type(const envoy_config_cluster_v3_Cluster *msg)
CommonTlsContext common_tls_context
UPB_INLINE upb_StringView envoy_config_core_v3_TransportSocket_name(const envoy_config_core_v3_TransportSocket *msg)
grpc_error_handle grpc_error_add_child(grpc_error_handle src, grpc_error_handle child)
Duration ParseDuration(const google_protobuf_Duration *proto_duration)
@ envoy_config_cluster_v3_Cluster_LOGICAL_DNS
const UPB_INLINE envoy_config_cluster_v3_CircuitBreakers_Thresholds *const * envoy_config_cluster_v3_CircuitBreakers_thresholds(const envoy_config_cluster_v3_CircuitBreakers *msg, size_t *len)
UPB_INLINE const struct envoy_config_core_v3_ConfigSource * envoy_config_cluster_v3_Cluster_EdsClusterConfig_eds_config(const envoy_config_cluster_v3_Cluster_EdsClusterConfig *msg)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
uint32_t max_concurrent_requests
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
absl::string_view cluster
constexpr size_type size() const noexcept
UPB_INLINE upb_StringView envoy_config_core_v3_SocketAddress_resolver_name(const envoy_config_core_v3_SocketAddress *msg)
UPB_INLINE uint64_t google_protobuf_UInt64Value_value(const google_protobuf_UInt64Value *msg)
UPB_INLINE const struct envoy_config_core_v3_Address * envoy_config_endpoint_v3_Endpoint_address(const envoy_config_endpoint_v3_Endpoint *msg)
UPB_INLINE const struct envoy_config_endpoint_v3_ClusterLoadAssignment * envoy_config_cluster_v3_Cluster_load_assignment(const envoy_config_cluster_v3_Cluster *msg)
const UPB_INLINE envoy_config_endpoint_v3_Endpoint * envoy_config_endpoint_v3_LbEndpoint_endpoint(const envoy_config_endpoint_v3_LbEndpoint *msg)
UPB_INLINE int32_t envoy_config_cluster_v3_Cluster_type(const envoy_config_cluster_v3_Cluster *msg)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
CertificateProviderPluginInstance ca_certificate_provider_instance
UPB_INLINE bool envoy_config_core_v3_ConfigSource_has_self(const envoy_config_core_v3_ConfigSource *msg)
UPB_INLINE bool envoy_config_cluster_v3_Cluster_has_type(const envoy_config_cluster_v3_Cluster *msg)
std::vector< std::string > prioritized_cluster_names
std::string JoinHostPort(absl::string_view host, int port)
const UPB_INLINE envoy_config_core_v3_SocketAddress * envoy_config_core_v3_Address_socket_address(const envoy_config_core_v3_Address *msg)
UPB_INLINE upb_StringView envoy_config_core_v3_SocketAddress_address(const envoy_config_core_v3_SocketAddress *msg)
const UPB_INLINE upb_MessageDef * envoy_config_cluster_v3_Cluster_getmsgdef(upb_DefPool *s)
UPB_INLINE const struct envoy_config_cluster_v3_CircuitBreakers * envoy_config_cluster_v3_Cluster_circuit_breakers(const envoy_config_cluster_v3_Cluster *msg)
CertificateValidationContext certificate_validation_context
struct envoy_config_cluster_v3_Cluster envoy_config_cluster_v3_Cluster
struct envoy_config_cluster_v3_CircuitBreakers_Thresholds envoy_config_cluster_v3_CircuitBreakers_Thresholds
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
UPB_INLINE const struct envoy_config_core_v3_ConfigSource * envoy_config_cluster_v3_Cluster_lrs_server(const envoy_config_cluster_v3_Cluster *msg)
UPB_INLINE uint32_t google_protobuf_UInt32Value_value(const google_protobuf_UInt32Value *msg)
const UPB_INLINE envoy_config_cluster_v3_Cluster_CustomClusterType * envoy_config_cluster_v3_Cluster_cluster_type(const envoy_config_cluster_v3_Cluster *msg)
absl::StatusOr< DecodeResult > Decode(const XdsEncodingContext &context, absl::string_view serialized_resource, bool is_v2) const override
absl::optional< XdsBootstrap::XdsServer > lrs_load_reporting_server
size_t upb_TextEncode(const upb_Message *msg, const upb_MessageDef *m, const upb_DefPool *ext_pool, int options, char *buf, size_t size)
std::string ToString() const
const UPB_INLINE envoy_config_cluster_v3_Cluster_EdsClusterConfig * envoy_config_cluster_v3_Cluster_eds_cluster_config(const envoy_config_cluster_v3_Cluster *msg)
const UPB_INLINE envoy_config_cluster_v3_Cluster_RingHashLbConfig * envoy_config_cluster_v3_Cluster_ring_hash_lb_config(const envoy_config_cluster_v3_Cluster *msg)
std::string grpc_error_std_string(grpc_error_handle error)
#define GRPC_ERROR_CREATE_FROM_CPP_STRING(desc)
UPB_INLINE upb_StringView envoy_config_cluster_v3_Cluster_CustomClusterType_name(const envoy_config_cluster_v3_Cluster_CustomClusterType *msg)
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_enforcing_success_rate(const envoy_config_cluster_v3_OutlierDetection *msg)
const UPB_INLINE envoy_extensions_transport_sockets_tls_v3_CommonTlsContext * envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_common_tls_context(const envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext *msg)
UPB_INLINE int32_t envoy_config_cluster_v3_CircuitBreakers_Thresholds_priority(const envoy_config_cluster_v3_CircuitBreakers_Thresholds *msg)
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_failure_percentage_request_volume(const envoy_config_cluster_v3_OutlierDetection *msg)
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_success_rate_minimum_hosts(const envoy_config_cluster_v3_OutlierDetection *msg)
UPB_INLINE upb_StringView const * envoy_extensions_clusters_aggregate_v3_ClusterConfig_clusters(const envoy_extensions_clusters_aggregate_v3_ClusterConfig *msg, size_t *len)
struct google_protobuf_Duration google_protobuf_Duration
struct envoy_config_core_v3_TransportSocket envoy_config_core_v3_TransportSocket
#define GRPC_ERROR_UNREF(err)
struct envoy_config_cluster_v3_Cluster_CustomClusterType envoy_config_cluster_v3_Cluster_CustomClusterType
UPB_INLINE upb_StringView envoy_config_cluster_v3_Cluster_name(const envoy_config_cluster_v3_Cluster *msg)
struct google_protobuf_UInt64Value google_protobuf_UInt64Value
static grpc_error_handle Parse(const XdsEncodingContext &context, const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext *common_tls_context_proto, CommonTlsContext *common_tls_context)
UPB_INLINE bool envoy_config_core_v3_ConfigSource_has_ads(const envoy_config_core_v3_ConfigSource *msg)
std::string instance_name
constexpr bool empty() const noexcept
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_enforcing_failure_percentage(const envoy_config_cluster_v3_OutlierDetection *msg)
grpc::ClientContext context
struct envoy_config_core_v3_ConfigSource envoy_config_core_v3_ConfigSource
UPB_INLINE const struct google_protobuf_UInt64Value * envoy_config_cluster_v3_Cluster_RingHashLbConfig_maximum_ring_size(const envoy_config_cluster_v3_Cluster_RingHashLbConfig *msg)
UPB_INLINE const struct google_protobuf_Duration * envoy_config_cluster_v3_OutlierDetection_max_ejection_time(const envoy_config_cluster_v3_OutlierDetection *msg)
struct google_protobuf_UInt32Value google_protobuf_UInt32Value
UPB_INLINE upb_StringView envoy_config_cluster_v3_Cluster_EdsClusterConfig_service_name(const envoy_config_cluster_v3_Cluster_EdsClusterConfig *msg)
UPB_INLINE const struct envoy_config_cluster_v3_OutlierDetection * envoy_config_cluster_v3_Cluster_outlier_detection(const envoy_config_cluster_v3_Cluster *msg)
@ envoy_config_cluster_v3_Cluster_RingHashLbConfig_XX_HASH
constexpr const_pointer data() const noexcept
UPB_INLINE const struct google_protobuf_Any * envoy_config_cluster_v3_Cluster_CustomClusterType_typed_config(const envoy_config_cluster_v3_Cluster_CustomClusterType *msg)
absl::string_view UpbStringToAbsl(const upb_StringView &str)
UPB_INLINE bool envoy_config_cluster_v3_Cluster_has_outlier_detection(const envoy_config_cluster_v3_Cluster *msg)
UPB_INLINE int32_t envoy_config_cluster_v3_Cluster_lb_policy(const envoy_config_cluster_v3_Cluster *msg)
UPB_INLINE upb_StringView google_protobuf_Any_value(const google_protobuf_Any *msg)
static const char * type_name(int type)
#define GRPC_ERROR_IS_NONE(err)
struct envoy_extensions_clusters_aggregate_v3_ClusterConfig envoy_extensions_clusters_aggregate_v3_ClusterConfig
UPB_INLINE const struct google_protobuf_UInt32Value * envoy_config_cluster_v3_OutlierDetection_success_rate_request_volume(const envoy_config_cluster_v3_OutlierDetection *msg)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:57