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.endpoint.v3; 20 21import "src/proto/grpc/testing/xds/v3/address.proto"; 22import "src/proto/grpc/testing/xds/v3/base.proto"; 23import "src/proto/grpc/testing/xds/v3/percent.proto"; 24 25import "google/protobuf/wrappers.proto"; 26 27// [#protodoc-title: Endpoints] 28 29// Endpoint health status. 30enum HealthStatus { 31 // The health status is not known. This is interpreted by Envoy as *HEALTHY*. 32 UNKNOWN = 0; 33 34 // Healthy. 35 HEALTHY = 1; 36 37 // Unhealthy. 38 UNHEALTHY = 2; 39 40 // Connection draining in progress. E.g., 41 // `<https://aws.amazon.com/blogs/aws/elb-connection-draining-remove-instances-from-service-with-care/>`_ 42 // or 43 // `<https://cloud.google.com/compute/docs/load-balancing/enabling-connection-draining>`_. 44 // This is interpreted by Envoy as *UNHEALTHY*. 45 DRAINING = 3; 46 47 // Health check timed out. This is part of HDS and is interpreted by Envoy as 48 // *UNHEALTHY*. 49 TIMEOUT = 4; 50 51 // Degraded. 52 DEGRADED = 5; 53} 54 55// Upstream host identifier. 56message Endpoint { 57 // The upstream host address. 58 // 59 // .. attention:: 60 // 61 // The form of host address depends on the given cluster type. For STATIC or EDS, 62 // it is expected to be a direct IP address (or something resolvable by the 63 // specified :ref:`resolver <envoy_api_field_config.core.v3.SocketAddress.resolver_name>` 64 // in the Address). For LOGICAL or STRICT DNS, it is expected to be hostname, 65 // and will be resolved via DNS. 66 core.v3.Address address = 1; 67} 68 69// An Endpoint that Envoy can route traffic to. 70// [#next-free-field: 6] 71message LbEndpoint { 72 // Upstream host identifier or a named reference. 73 oneof host_identifier { 74 Endpoint endpoint = 1; 75 } 76 77 // Optional health status when known and supplied by EDS server. 78 HealthStatus health_status = 2; 79} 80 81// A group of endpoints belonging to a Locality. 82// One can have multiple LocalityLbEndpoints for a locality, but this is 83// generally only done if the different groups need to have different load 84// balancing weights or different priorities. 85// [#next-free-field: 7] 86message LocalityLbEndpoints { 87 // Identifies location of where the upstream hosts run. 88 core.v3.Locality locality = 1; 89 90 // The group of endpoints belonging to the locality specified. 91 repeated LbEndpoint lb_endpoints = 2; 92 93 // Optional: Per priority/region/zone/sub_zone weight; at least 1. The load 94 // balancing weight for a locality is divided by the sum of the weights of all 95 // localities at the same priority level to produce the effective percentage 96 // of traffic for the locality. The sum of the weights of all localities at 97 // the same priority level must not exceed uint32_t maximal value (4294967295). 98 // 99 // Locality weights are only considered when :ref:`locality weighted load 100 // balancing <arch_overview_load_balancing_locality_weighted_lb>` is 101 // configured. These weights are ignored otherwise. If no weights are 102 // specified when locality weighted load balancing is enabled, the locality is 103 // assigned no load. 104 google.protobuf.UInt32Value load_balancing_weight = 3; 105 106 // Optional: the priority for this LocalityLbEndpoints. If unspecified this will 107 // default to the highest priority (0). 108 // 109 // Under usual circumstances, Envoy will only select endpoints for the highest 110 // priority (0). In the event all endpoints for a particular priority are 111 // unavailable/unhealthy, Envoy will fail over to selecting endpoints for the 112 // next highest priority group. 113 // 114 // Priorities should range from 0 (highest) to N (lowest) without skipping. 115 uint32 priority = 5; 116} 117 118// [#protodoc-title: Endpoint configuration] 119// Endpoint discovery :ref:`architecture overview <arch_overview_service_discovery_types_eds>` 120 121// Each route from RDS will map to a single cluster or traffic split across 122// clusters using weights expressed in the RDS WeightedCluster. 123// 124// With EDS, each cluster is treated independently from a LB perspective, with 125// LB taking place between the Localities within a cluster and at a finer 126// granularity between the hosts within a locality. The percentage of traffic 127// for each endpoint is determined by both its load_balancing_weight, and the 128// load_balancing_weight of its locality. First, a locality will be selected, 129// then an endpoint within that locality will be chose based on its weight. 130// [#next-free-field: 6] 131message ClusterLoadAssignment { 132 // Load balancing policy settings. 133 // [#next-free-field: 6] 134 message Policy { 135 message DropOverload { 136 // Identifier for the policy specifying the drop. 137 string category = 1; 138 139 // Percentage of traffic that should be dropped for the category. 140 type.v3.FractionalPercent drop_percentage = 2; 141 } 142 143 // Action to trim the overall incoming traffic to protect the upstream 144 // hosts. This action allows protection in case the hosts are unable to 145 // recover from an outage, or unable to autoscale or unable to handle 146 // incoming traffic volume for any reason. 147 // 148 // At the client each category is applied one after the other to generate 149 // the 'actual' drop percentage on all outgoing traffic. For example: 150 // 151 // .. code-block:: json 152 // 153 // { "drop_overloads": [ 154 // { "category": "throttle", "drop_percentage": 60 } 155 // { "category": "lb", "drop_percentage": 50 } 156 // ]} 157 // 158 // The actual drop percentages applied to the traffic at the clients will be 159 // "throttle"_drop = 60% 160 // "lb"_drop = 20% // 50% of the remaining 'actual' load, which is 40%. 161 // actual_outgoing_load = 20% // remaining after applying all categories. 162 repeated DropOverload drop_overloads = 2; 163 } 164 165 // Name of the cluster. This will be the :ref:`service_name 166 // <envoy_api_field_config.cluster.v3.Cluster.EdsClusterConfig.service_name>` value if specified 167 // in the cluster :ref:`EdsClusterConfig 168 // <envoy_api_msg_config.cluster.v3.Cluster.EdsClusterConfig>`. 169 string cluster_name = 1; 170 171 // List of endpoints to load balance to. 172 repeated LocalityLbEndpoints endpoints = 2; 173 174 // Load balancing policy settings. 175 Policy policy = 4; 176} 177