• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
30// Aggregated Discovery Service (ADS) options. This is currently empty, but when
31// set in :ref:`ConfigSource <envoy_api_msg_core.ConfigSource>` can be used to
32// specify that ADS is to be used.
33message AggregatedConfigSource {
34}
35
36message SelfConfigSource {
37}
38
39message ConfigSource {
40  oneof config_source_specifier {
41    // When set, ADS will be used to fetch resources. The ADS API configuration
42    // source in the bootstrap configuration is used.
43    AggregatedConfigSource ads = 3;
44
45    // [#not-implemented-hide:]
46    // When set, the client will access the resources from the same server it got the
47    // ConfigSource from, although not necessarily from the same stream. This is similar to the
48    // :ref:`ads<envoy_api_field.ConfigSource.ads>` field, except that the client may use a
49    // different stream to the same server. As a result, this field can be used for things
50    // like LRS that cannot be sent on an ADS stream. It can also be used to link from (e.g.)
51    // LDS to RDS on the same server without requiring the management server to know its name
52    // or required credentials.
53    // [#next-major-version: In xDS v3, consider replacing the ads field with this one, since
54    // this field can implicitly mean to use the same stream in the case where the ConfigSource
55    // is provided via ADS and the specified data can also be obtained via ADS.]
56    SelfConfigSource self = 5;
57  }
58}
59
60message Cluster {
61  // Refer to :ref:`service discovery type <arch_overview_service_discovery_types>`
62  // for an explanation on each type.
63  enum DiscoveryType {
64    // Refer to the :ref:`static discovery type<arch_overview_service_discovery_types_static>`
65    // for an explanation.
66    STATIC = 0;
67
68    // Refer to the :ref:`strict DNS discovery
69    // type<arch_overview_service_discovery_types_strict_dns>`
70    // for an explanation.
71    STRICT_DNS = 1;
72
73    // Refer to the :ref:`logical DNS discovery
74    // type<arch_overview_service_discovery_types_logical_dns>`
75    // for an explanation.
76    LOGICAL_DNS = 2;
77
78    // Refer to the :ref:`service discovery type<arch_overview_service_discovery_types_eds>`
79    // for an explanation.
80    EDS = 3;
81
82    // Refer to the :ref:`original destination discovery
83    // type<arch_overview_service_discovery_types_original_destination>`
84    // for an explanation.
85    ORIGINAL_DST = 4;
86  }
87
88  string name = 1;
89
90  oneof cluster_discovery_type {
91    // The :ref:`service discovery type <arch_overview_service_discovery_types>`
92    // to use for resolving the cluster.
93    DiscoveryType type = 2;
94  }
95
96  // Only valid when discovery type is EDS.
97  message EdsClusterConfig {
98    // Configuration for the source of EDS updates for this Cluster.
99    ConfigSource eds_config = 1;
100
101    // Optional alternative to cluster name to present to EDS. This does not
102    // have the same restrictions as cluster name, i.e. it may be arbitrary
103    // length.
104    string service_name = 2;
105  }
106
107  // Refer to :ref:`load balancer type <arch_overview_load_balancing_types>` architecture
108  // overview section for information on each type.
109  enum LbPolicy {
110    // Refer to the :ref:`round robin load balancing
111    // policy<arch_overview_load_balancing_types_round_robin>`
112    // for an explanation.
113    ROUND_ROBIN = 0;
114
115    // Refer to the :ref:`least request load balancing
116    // policy<arch_overview_load_balancing_types_least_request>`
117    // for an explanation.
118    LEAST_REQUEST = 1;
119
120    // Refer to the :ref:`ring hash load balancing
121    // policy<arch_overview_load_balancing_types_ring_hash>`
122    // for an explanation.
123    RING_HASH = 2;
124
125    // Refer to the :ref:`random load balancing
126    // policy<arch_overview_load_balancing_types_random>`
127    // for an explanation.
128    RANDOM = 3;
129
130    // Refer to the :ref:`original destination load balancing
131    // policy<arch_overview_load_balancing_types_original_destination>`
132    // for an explanation.
133    //
134    // .. attention::
135    //
136    //   **This load balancing policy is deprecated**. Use CLUSTER_PROVIDED instead.
137    //
138    ORIGINAL_DST_LB = 4;
139
140    // Refer to the :ref:`Maglev load balancing policy<arch_overview_load_balancing_types_maglev>`
141    // for an explanation.
142    MAGLEV = 5;
143
144    // This load balancer type must be specified if the configured cluster provides a cluster
145    // specific load balancer. Consult the configured cluster's documentation for whether to set
146    // this option or not.
147    CLUSTER_PROVIDED = 6;
148  }
149  // The :ref:`load balancer type <arch_overview_load_balancing_types>` to use
150  // when picking a host in the cluster.
151  LbPolicy lb_policy = 6;
152
153  // Configuration to use for EDS updates for the Cluster.
154  EdsClusterConfig eds_cluster_config = 3;
155
156  ConfigSource lrs_server = 42;
157}
158