1// Copyright 2020 The gRPC Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Local copy of Envoy xDS proto file, used for testing only. 16 17syntax = "proto3"; 18 19package envoy.config.cluster.v3; 20 21import "src/proto/grpc/testing/xds/v3/base.proto"; 22import "src/proto/grpc/testing/xds/v3/config_source.proto"; 23 24import "google/protobuf/any.proto"; 25import "google/protobuf/wrappers.proto"; 26 27enum RoutingPriority { 28 DEFAULT = 0; 29 HIGH = 1; 30} 31 32message CircuitBreakers { 33 message Thresholds { 34 RoutingPriority priority = 1; 35 google.protobuf.UInt32Value max_requests = 4; 36 } 37 repeated Thresholds thresholds = 1; 38} 39 40// Extended cluster type. 41message CustomClusterType { 42 // The type of the cluster to instantiate. The name must match a supported cluster type. 43 string name = 1; 44 45 // Cluster specific configuration which depends on the cluster being instantiated. 46 // See the supported cluster for further documentation. 47 google.protobuf.Any typed_config = 2; 48} 49 50// [#protodoc-title: Cluster configuration] 51 52// Configuration for a single upstream cluster. 53// [#next-free-field: 48] 54message Cluster { 55 // Refer to :ref:`service discovery type <arch_overview_service_discovery_types>` 56 // for an explanation on each type. 57 enum DiscoveryType { 58 // Refer to the :ref:`static discovery type<arch_overview_service_discovery_types_static>` 59 // for an explanation. 60 STATIC = 0; 61 62 // Refer to the :ref:`strict DNS discovery 63 // type<arch_overview_service_discovery_types_strict_dns>` 64 // for an explanation. 65 STRICT_DNS = 1; 66 67 // Refer to the :ref:`logical DNS discovery 68 // type<arch_overview_service_discovery_types_logical_dns>` 69 // for an explanation. 70 LOGICAL_DNS = 2; 71 72 // Refer to the :ref:`service discovery type<arch_overview_service_discovery_types_eds>` 73 // for an explanation. 74 EDS = 3; 75 76 // Refer to the :ref:`original destination discovery 77 // type<arch_overview_service_discovery_types_original_destination>` 78 // for an explanation. 79 ORIGINAL_DST = 4; 80 } 81 82 // Refer to :ref:`load balancer type <arch_overview_load_balancing_types>` architecture 83 // overview section for information on each type. 84 enum LbPolicy { 85 reserved 4; 86 87 reserved "ORIGINAL_DST_LB"; 88 89 // Refer to the :ref:`round robin load balancing 90 // policy<arch_overview_load_balancing_types_round_robin>` 91 // for an explanation. 92 ROUND_ROBIN = 0; 93 94 // Refer to the :ref:`least request load balancing 95 // policy<arch_overview_load_balancing_types_least_request>` 96 // for an explanation. 97 LEAST_REQUEST = 1; 98 99 // Refer to the :ref:`ring hash load balancing 100 // policy<arch_overview_load_balancing_types_ring_hash>` 101 // for an explanation. 102 RING_HASH = 2; 103 104 // Refer to the :ref:`random load balancing 105 // policy<arch_overview_load_balancing_types_random>` 106 // for an explanation. 107 RANDOM = 3; 108 109 // Refer to the :ref:`Maglev load balancing policy<arch_overview_load_balancing_types_maglev>` 110 // for an explanation. 111 MAGLEV = 5; 112 113 // This load balancer type must be specified if the configured cluster provides a cluster 114 // specific load balancer. Consult the configured cluster's documentation for whether to set 115 // this option or not. 116 CLUSTER_PROVIDED = 6; 117 118 // [#not-implemented-hide:] Use the new :ref:`load_balancing_policy 119 // <envoy_api_field_config.cluster.v3.Cluster.load_balancing_policy>` field to determine the LB policy. 120 // [#next-major-version: In the v3 API, we should consider deprecating the lb_policy field 121 // and instead using the new load_balancing_policy field as the one and only mechanism for 122 // configuring this.] 123 LOAD_BALANCING_POLICY_CONFIG = 7; 124 } 125 126 // Only valid when discovery type is EDS. 127 message EdsClusterConfig { 128 // Configuration for the source of EDS updates for this Cluster. 129 core.v3.ConfigSource eds_config = 1; 130 131 // Optional alternative to cluster name to present to EDS. This does not 132 // have the same restrictions as cluster name, i.e. it may be arbitrary 133 // length. 134 string service_name = 2; 135 } 136 137 // Supplies the name of the cluster which must be unique across all clusters. 138 // The cluster name is used when emitting 139 // :ref:`statistics <config_cluster_manager_cluster_stats>` if :ref:`alt_stat_name 140 // <envoy_api_field_config.cluster.v3.Cluster.alt_stat_name>` is not provided. 141 // Any ``:`` in the cluster name will be converted to ``_`` when emitting statistics. 142 string name = 1; 143 144 oneof cluster_discovery_type { 145 // The :ref:`service discovery type <arch_overview_service_discovery_types>` 146 // to use for resolving the cluster. 147 DiscoveryType type = 2; 148 149 // The custom cluster type. 150 CustomClusterType cluster_type = 38; 151 } 152 153 // Configuration to use for EDS updates for the Cluster. 154 EdsClusterConfig eds_cluster_config = 3; 155 156 // The :ref:`load balancer type <arch_overview_load_balancing_types>` to use 157 // when picking a host in the cluster. 158 LbPolicy lb_policy = 6; 159 160 CircuitBreakers circuit_breakers = 10; 161 162 // Optional custom transport socket implementation to use for upstream connections. 163 // To setup TLS, set a transport socket with name `tls` and 164 // :ref:`UpstreamTlsContexts <envoy_api_msg_extensions.transport_sockets.tls.v3.UpstreamTlsContext>` in the `typed_config`. 165 // If no transport socket configuration is specified, new connections 166 // will be set up with plaintext. 167 core.v3.TransportSocket transport_socket = 24; 168 169 // [#not-implemented-hide:] 170 // If present, tells the client where to send load reports via LRS. If not present, the 171 // client will fall back to a client-side default, which may be either (a) don't send any 172 // load reports or (b) send load reports for all clusters to a single default server 173 // (which may be configured in the bootstrap file). 174 // 175 // Note that if multiple clusters point to the same LRS server, the client may choose to 176 // create a separate stream for each cluster or it may choose to coalesce the data for 177 // multiple clusters onto a single stream. Either way, the client must make sure to send 178 // the data for any given cluster on no more than one stream. 179 // 180 // [#next-major-version: In the v3 API, we should consider restructuring this somehow, 181 // maybe by allowing LRS to go on the ADS stream, or maybe by moving some of the negotiation 182 // from the LRS stream here.] 183 core.v3.ConfigSource lrs_server = 42; 184} 185