1// Copyright 2019 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// This file contains the xds protocol and its dependency. It can't be used by 16// the gRPC library; otherwise there can be duplicate definition problems if 17// users depend on both gRPC and Envoy. It can only be used by gRPC tests. 18// 19// TODO(juanlishen): This file is a hack to avoid a problem we're 20// currently having where we can't depend on a proto file in an external 21// repo due to bazel limitations. Once that's fixed, this should be 22// removed. Until this, it should be used in the gRPC tests only, or else it 23// will cause a conflict due to the same proto messages being defined in 24// multiple files in the same binary. 25 26syntax = "proto3"; 27 28package envoy.api.v2; 29 30import "google/protobuf/wrappers.proto"; 31 32// Aggregated Discovery Service (ADS) options. This is currently empty, but when 33// set in :ref:`ConfigSource <envoy_api_msg_core.ConfigSource>` can be used to 34// specify that ADS is to be used. 35message AggregatedConfigSource { 36} 37 38message SelfConfigSource { 39} 40 41message ConfigSource { 42 oneof config_source_specifier { 43 // When set, ADS will be used to fetch resources. The ADS API configuration 44 // source in the bootstrap configuration is used. 45 AggregatedConfigSource ads = 3; 46 47 // [#not-implemented-hide:] 48 // When set, the client will access the resources from the same server it got the 49 // ConfigSource from, although not necessarily from the same stream. This is similar to the 50 // :ref:`ads<envoy_api_field.ConfigSource.ads>` field, except that the client may use a 51 // different stream to the same server. As a result, this field can be used for things 52 // like LRS that cannot be sent on an ADS stream. It can also be used to link from (e.g.) 53 // LDS to RDS on the same server without requiring the management server to know its name 54 // or required credentials. 55 // [#next-major-version: In xDS v3, consider replacing the ads field with this one, since 56 // this field can implicitly mean to use the same stream in the case where the ConfigSource 57 // is provided via ADS and the specified data can also be obtained via ADS.] 58 SelfConfigSource self = 5; 59 } 60} 61 62enum RoutingPriority { 63 DEFAULT = 0; 64 HIGH = 1; 65} 66 67message CircuitBreakers { 68 message Thresholds { 69 RoutingPriority priority = 1; 70 google.protobuf.UInt32Value max_requests = 4; 71 } 72 repeated Thresholds thresholds = 1; 73} 74 75message ClusterConfig { 76 repeated string clusters = 1; 77} 78 79message CustomClusterType { 80 string name = 1; 81 ClusterConfig typed_config = 2; 82} 83 84message Cluster { 85 // Refer to :ref:`service discovery type <arch_overview_service_discovery_types>` 86 // for an explanation on each type. 87 enum DiscoveryType { 88 // Refer to the :ref:`static discovery type<arch_overview_service_discovery_types_static>` 89 // for an explanation. 90 STATIC = 0; 91 92 // Refer to the :ref:`strict DNS discovery 93 // type<arch_overview_service_discovery_types_strict_dns>` 94 // for an explanation. 95 STRICT_DNS = 1; 96 97 // Refer to the :ref:`logical DNS discovery 98 // type<arch_overview_service_discovery_types_logical_dns>` 99 // for an explanation. 100 LOGICAL_DNS = 2; 101 102 // Refer to the :ref:`service discovery type<arch_overview_service_discovery_types_eds>` 103 // for an explanation. 104 EDS = 3; 105 106 // Refer to the :ref:`original destination discovery 107 // type<arch_overview_service_discovery_types_original_destination>` 108 // for an explanation. 109 ORIGINAL_DST = 4; 110 } 111 112 string name = 1; 113 114 oneof cluster_discovery_type { 115 // The :ref:`service discovery type <arch_overview_service_discovery_types>` 116 // to use for resolving the cluster. 117 DiscoveryType type = 2; 118 119 // The custom cluster type: aggregate cluster in this case. 120 CustomClusterType cluster_type = 38; 121 } 122 123 // Only valid when discovery type is EDS. 124 message EdsClusterConfig { 125 // Configuration for the source of EDS updates for this Cluster. 126 ConfigSource eds_config = 1; 127 128 // Optional alternative to cluster name to present to EDS. This does not 129 // have the same restrictions as cluster name, i.e. it may be arbitrary 130 // length. 131 string service_name = 2; 132 } 133 134 // Refer to :ref:`load balancer type <arch_overview_load_balancing_types>` architecture 135 // overview section for information on each type. 136 enum LbPolicy { 137 // Refer to the :ref:`round robin load balancing 138 // policy<arch_overview_load_balancing_types_round_robin>` 139 // for an explanation. 140 ROUND_ROBIN = 0; 141 142 // Refer to the :ref:`least request load balancing 143 // policy<arch_overview_load_balancing_types_least_request>` 144 // for an explanation. 145 LEAST_REQUEST = 1; 146 147 // Refer to the :ref:`ring hash load balancing 148 // policy<arch_overview_load_balancing_types_ring_hash>` 149 // for an explanation. 150 RING_HASH = 2; 151 152 // Refer to the :ref:`random load balancing 153 // policy<arch_overview_load_balancing_types_random>` 154 // for an explanation. 155 RANDOM = 3; 156 157 // Refer to the :ref:`original destination load balancing 158 // policy<arch_overview_load_balancing_types_original_destination>` 159 // for an explanation. 160 // 161 // .. attention:: 162 // 163 // **This load balancing policy is deprecated**. Use CLUSTER_PROVIDED instead. 164 // 165 ORIGINAL_DST_LB = 4; 166 167 // Refer to the :ref:`Maglev load balancing policy<arch_overview_load_balancing_types_maglev>` 168 // for an explanation. 169 MAGLEV = 5; 170 171 // This load balancer type must be specified if the configured cluster provides a cluster 172 // specific load balancer. Consult the configured cluster's documentation for whether to set 173 // this option or not. 174 CLUSTER_PROVIDED = 6; 175 } 176 // The :ref:`load balancer type <arch_overview_load_balancing_types>` to use 177 // when picking a host in the cluster. 178 LbPolicy lb_policy = 6; 179 180 // Configuration to use for EDS updates for the Cluster. 181 EdsClusterConfig eds_cluster_config = 3; 182 183 CircuitBreakers circuit_breakers = 10; 184 185 ConfigSource lrs_server = 42; 186} 187