Module: Async::GRPC::XDS::Cluster
Overview
Builds Envoy cluster resources.
Constant Summary collapse
- TYPE_URL =
"type.googleapis.com/envoy.config.cluster.v3.Cluster"
Instance Method Summary collapse
-
#build(name, service_name: name, load_balancing_policy: nil, connect_timeout: 5, protocol: :http2) ⇒ Object
Build an EDS cluster resource.
Instance Method Details
#build(name, service_name: name, load_balancing_policy: nil, connect_timeout: 5, protocol: :http2) ⇒ Object
Build an EDS cluster resource.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/async/grpc/xds/cluster.rb', line 29 def build(name, service_name: name, load_balancing_policy: nil, connect_timeout: 5, protocol: :http2) = { name: name.to_s, type: Envoy::Config::Cluster::V3::Cluster::DiscoveryType::EDS, eds_cluster_config: Envoy::Config::Cluster::V3::Cluster::EdsClusterConfig.new( service_name: service_name.to_s, eds_config: Envoy::Config::Core::V3::ConfigSource.new( ads: Envoy::Config::Core::V3::AggregatedConfigSource.new ) ), connect_timeout: duration(connect_timeout), } [:load_balancing_policy] = load_balancing_policy if load_balancing_policy case protocol when :http1 # Envoy uses HTTP/1 by default. when :http2 [:http2_protocol_options] = Envoy::Config::Core::V3::Http2ProtocolOptions.new else raise ArgumentError, "Unsupported upstream protocol: #{protocol.inspect}" end Envoy::Config::Cluster::V3::Cluster.new(**) end |