| 1 | TP1: xdstp:// structured resource naming, caching and federation support. |
| 2 | ---- |
| 3 | * Author(s): Harvey Tuch, Louis Ryan, Mark Roth, Costin Manolache, Matt Klein |
| 4 | * Approver: |
| 5 | * Implemented in: <xDS client, ...> |
| 6 | * Last updated: 2021-08-21 |
| 7 | |
| 8 | ## Abstract |
| 9 | |
| 10 | This proposal describes a set of related changes to the [xDS transport |
| 11 | protocol](https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol) |
| 12 | aimed at supporting caching, federation, scalability and improved reliability of |
| 13 | the xDS transport. |
| 14 | |
| 15 | These changes are motivated by the growth of the xDS ecosystem, including client |
| 16 | diversity, range of deployments, layering of config/control pipelines and desire |
| 17 | for hybrid control plane topologies in the xDS community. |
| 18 | |
| 19 | We introduce a new structured resource naming format based on Uniform Resource |
| 20 | Identifiers (URIs) with the `xdstp://` scheme. xDS resource names can now |
| 21 | function as independent cache keys without requiring additional transport |
| 22 | context. In addition, resource names support a notion of named authority, |
| 23 | namespace delegation and failover. |
| 24 | |
| 25 | A distinction between resource singletons and collections is also included in |
| 26 | the transport protocol. This formalizes some of the loose conventions that |
| 27 | Envoy's use of xDS had established and allows for generalization for use cases |
| 28 | such as [LEDS](https://github.com/envoyproxy/envoy/issues/10373). These changes |
| 29 | help to eliminate technical debt in the transport protocol, by removing special |
| 30 | case treatment of LDS and CDS in xDS, deprecating resource name aliases and |
| 31 | aligning the future of the transport protocol behind delta xDS. |
| 32 | |
| 33 | ## Background |
| 34 | |
| 35 | Since the introduction of v2 xDS in Envoy, the transport protocol has provided a |
| 36 | generic pub-sub mechanism between client (Envoy) and management server (xDS |
| 37 | control plane). The resources have been opaque, identified by a type |
| 38 | URL, opaque resource name string and opaque version string. |
| 39 | |
| 40 | For example, a route configuration resource named `foo` would have type URL |
| 41 | `envoy.config.route.v3.RouteConfiguration` and a version string such as `42-a`. |
| 42 | |
| 43 | In addition, control planes have interpreted the |
| 44 | [`Node`](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/base.proto#envoy-v3-api-msg-config-core-v3-node) |
| 45 | message presented at the start of an xDS transport stream to provide further |
| 46 | contextual information, for example node ID, locality, credentials, tenancy information, |
| 47 | user agent, local environment configuration, etc. In general, |
| 48 | arbitrary key-value metadata is expressible in the `Node` message. |
| 49 | |
| 50 | While the xDS resource naming scheme above identifies a single resource, special case |
| 51 | provisions were needed for collections; LDS and CDS resource collections were treated in a |
| 52 | distinguished manner by interpreting empty resources request sets as wildcards. |
| 53 | |
| 54 | An Aggregated Discovery Stream (ADS) was introduced to Envoy to support |
| 55 | greater efficiency, server stickiness and better-than-eventual consistency for |
| 56 | API updates. A single control plane server was assumed, since Envoy had |
| 57 | mostly been used in direct client-server applications. |
| 58 | |
| 59 | While this has been sufficient for many use cases to date, a number of limitations |
| 60 | have become evident which this proposal addresses. These are enumerated in the |
| 61 | following sub-sections. |
| 62 | |
| 63 | ### Caching & Scalability |
| 64 | |
| 65 | As the xDS and Envoy ecosystems have grown, so has the number of applications where xDS |
| 66 | finds itself used. Some of these applications require caching of xDS resources, |
| 67 | for example: |
| 68 | |
| 69 | * Scalable control planes that deal with the problem of client fan-out. An |
| 70 | example of a project tackling this is |
| 71 | [xds-relay](https://github.com/envoyproxy/xds-relay). |
| 72 | * Hybrid on-premise/cloud clients and control planes. Resources might be |
| 73 | cached |
| 74 | on-premise to enhance reliability in the event of an interconnect outage. |
| 75 | * Mobile and edge, where an xDS client such as Envoy runs in mobile |
| 76 | applications with `O(millions+)` of xDS clients interacting with a control |
| 77 | plane. An example project in this space is [Envoy |
| 78 | Mobile](https://github.com/envoyproxy/envoy-mobile). |
| 79 | |
| 80 | In some cases, control planes have been observed as treating xDS resources as *mutable*. Depending on the |
| 81 | contents of the `Node` message (which may change over the lifetime of an xDS |
| 82 | transport stream), they can provide the same resource `foo` at a given version |
| 83 | with different values. |
| 84 | |
| 85 | This impacts cacheability; the `Node` message becomes part of the cache key (and |
| 86 | must be distributed across [xDS |
| 87 | relays](https://docs.google.com/document/d/1X9fFzqBZzrSmx2d0NkmjDW2tc8ysbLQS9LaRQRxdJZU/edit?disco=AAAAGQ_84vU&ts=5e61532c&usp_dm=false)). |
| 88 | This conflates client identity with resource identity. Some of the `Node` |
| 89 | message is only relevant on a single hop to the management server, but in more |
| 90 | complex topologies other attributes (e.g. metadata) are what really matter when |
| 91 | trying to fetch a resource. |
| 92 | |
| 93 | The proposal below introduces *immutable* resource names which fully encapsulate |
| 94 | resource context; an xDS resource name URI is a cache key, control planes are |
| 95 | expected to provide resource [idempotence](https://restfulapi.net/idempotent-rest-apis/) for |
| 96 | client resource fetches at a given resource version. |
| 97 | |
| 98 | ### Federation |
| 99 | |
| 100 | xDS federation describes an xDS client that fetches resources from more than one |
| 101 | management server. A single xDS client's configuration is disaggregated across |
| 102 | multiple authorities. Other features of federation include delegation of |
| 103 | authority between management servers, failover and support for hybrid topologies |
| 104 | (e.g. on-premise/cloud, cloud A/B). Some example use cases: |
| 105 | |
| 106 | * Failover from a Control Plane as-a-service (CPaaS) to an on-premise control |
| 107 | plane during a network partition. |
| 108 | * On-premise authoring and publication of xDS fragments to a CPaaS. |
| 109 | * Disaggregating responsibility for load balancing APIs between on-premise and |
| 110 | CPaaS. For example splitting the health check and load assignment |
| 111 | responsibilities. |
| 112 | * Disaggregating an xDS control plane internally. Complex xDS control planes |
| 113 | may benefit from having multiple independent xDS providers with limited |
| 114 | coupling. |
| 115 | * Bridging independent service meshes with independent control planes. |
| 116 | |
| 117 | While there are many challenges in xDS federation, including: |
| 118 | |
| 119 | * Trust management, e.g. resource signing. |
| 120 | * Improving resource composition and granularity when splitting provenence. |
| 121 | * Coordination over authority delegation between management servers. |
| 122 | |
| 123 | we do not aim to tackle all of these below, instead restricting the proposal to |
| 124 | a structured naming scheme that will provide the basis for future solutions to |
| 125 | the full set of federation concerns. |
| 126 | |
| 127 | We define a control plane serving a given xDS resource as an *authority*. The |
| 128 | proposal below introduces indirection to avoid the existing xDS conflation between the |
| 129 | naming of an authority and the configuration of fetches from the authority (a |
| 130 | [`ConfigSource`](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/config_source.proto#envoy-v3-api-msg-config-core-v3-configsource) |
| 131 | message). This conflation makes it challenging to use multiple authorities today |
| 132 | and contributes to configuration size scalability problems when federating. |
| 133 | The proposal includes the authority in the xDS resource name URI. |
| 134 | |
| 135 | ### xDS transport protocol technical debt |
| 136 | |
| 137 | Since the xDS transport protocol has been historically co-developed with the |
| 138 | Envoy implementation, this close coupling and evolution (vs. upfront design) has |
| 139 | given rise to acknowledged technical debt relating to resource naming and typing. |
| 140 | |
| 141 | #### Flat representation |
| 142 | |
| 143 | Today, resource identifies are a hodge podge of resource name, `Node` message, |
| 144 | authority from `ConfigSource`, type URL and version. When communicating between |
| 145 | humans or systems that don’t work with proto3 messages, there is no standard |
| 146 | format for concisely encoding this information. |
| 147 | |
| 148 | URIs provide a powerful standards compliant way of specifying this information. |
| 149 | |
| 150 | #### Collections |
| 151 | |
| 152 | Using terminology from [REST resource |
| 153 | naming](https://restfulapi.net/resource-naming/), xDS supports both singleton |
| 154 | and collection discovery. For xDS types such as RDS/EDS/SDS, singleton |
| 155 | resource names are provided explicitly in the discovery request, and returned. |
| 156 | For other xDS types, e.g. CDS/LDS, an implicit wildcard name is expressed |
| 157 | via an empty request resource name set. |
| 158 | |
| 159 | The limitations of this approach for collections become apparent when you |
| 160 | consider what might be needed to select a subset of listeners or clusters via |
| 161 | LDS/CDS. Often `Node` metadata is used for this purpose, which conflates node |
| 162 | identity with per-resource type naming semantics. Reasons to subset the |
| 163 | universe of resources for a given type include: |
| 164 | |
| 165 | * Differentiating inbound/outbound listeners in a service mesh topology. |
| 166 | * Sharding tenant listeners between different nodes in a multi-tenant proxy |
| 167 | fleet. |
| 168 | * Distinguishing based on node function in a service mesh (e.g. ingress/egress). |
| 169 | |
| 170 | Collection namespacing is also necessary for scalable endpoint support |
| 171 | in [LEDS](https://github.com/envoyproxy/envoy/issues/10373). |
| 172 | |
| 173 | In the proposal below, we introduce an explicit notion of collections and |
| 174 | namespaces, expressed through xDS resource name URIs. |
| 175 | |
| 176 | #### Per-resource type transport naming semantics |
| 177 | |
| 178 | While most xDS resource types permit opaque resource naming at the discretion of |
| 179 | the control plane, some xDS resources, namely VHDS, have specific resource |
| 180 | name structure. VHDS requires a specific form |
| 181 | [form](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/vhds.html?highlight=vhds#virtual-host-resource-naming-convention) |
| 182 | for referenced resources, `<route configuration name>/<host entry>`. This permits the management |
| 183 | server to lookup a missing virtual host with the host entry inside the |
| 184 | specified `RouteConfiguration` resource name. In this scheme, the route |
| 185 | configuration name is acting as a namespace for the virtual host name. |
| 186 | |
| 187 | It’s likely other resource types in the future will require some structure, e.g. |
| 188 | [LEDS](https://github.com/envoyproxy/envoy/issues/10373). Rather than living |
| 189 | with an arbitrary mix of opaque and structured forms, the URI-based xDS resource |
| 190 | naming scheme below provides a structured scheme that can serve the |
| 191 | expression needs of resource types such as VHDS and LEDS. |
| 192 | |
| 193 | #### Aliasing |
| 194 | |
| 195 | VHDS introduced aliasing to the xDS transport, since the same virtual host |
| 196 | resource may be known by multiple names, e.g. `routeConfigA/foo.com, |
| 197 | routeConfigA/bar.com`. This mechanism is not widely used yet elsewhere in xDS |
| 198 | and it is another example of mixing the transport and data model resource layers |
| 199 | in xDS. |
| 200 | |
| 201 | We introduce a redirection mechanism below that allows a control plane to |
| 202 | provide aliasing semantics without requiring explicit transport-level support |
| 203 | for aliasing. When querying for either `routeConfigA/foo.com` or `routeConfigA/bar.com`, the |
| 204 | management server might issue a redirect causing the xDS client to fetch |
| 205 | `someCanonicalVirtualHost` resource. |
| 206 | |
| 207 | This same mechanism is also useful when supporting resource delegation during |
| 208 | federation and removes special case treatment of aliasing from the xDS transport |
| 209 | protocol. |
| 210 | |
| 211 | ### Related Proposals: |
| 212 | |
| 213 | * The original Google Docs design documents: |
| 214 | [Full](https://docs.google.com/document/d/1zZav-IYxMO0mP2A7y5XHBa9v0eXyirw1CxrLLSUqWR8/edit#heading=h.w8hw2zbv3jwl) |
| 215 | [Summary](https://docs.google.com/document/d/1m5_Q9LUlzvDdImP0jqh1lSTrLMldsApTQX6ibbd3i7c/edit?ts=5ec2fd8a#heading=h.w8hw2zbv3jwl) |
| 216 | * [xDS transport protocol.](https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol) |
| 217 | |
| 218 | ## Proposal |
| 219 | |
| 220 | The proposal below is fully backwards compatible with the existing xDS transport |
| 221 | protocol and does not require any changes to clients or servers that do not wish |
| 222 | to opt into the new naming scheme. |
| 223 | |
| 224 | ### URI-based xDS resource names |
| 225 | |
| 226 | xDS URIs follow a [RFC-3986](https://tools.ietf.org/html/rfc3986) compliant |
| 227 | schema. The following schema is proposed for xDS resource names: |
| 228 | |
| 229 | `xdstp://[{authority}]/{resource type}/{id/*}?{context parameters}{#processing directive,*}` |
| 230 | |
| 231 | * `authority` is an opaque string naming a resource authority, e.g. |
| 232 | `some.control.plane`. |
| 233 | * `resource type` is the xDS resource type URL, e.g. `envoy.config.route.v3.RouteConfiguration` |
| 234 | * `id/*` is the remaining path component of the URI and is fully opaque; naming |
| 235 | is at the discretion of the control plane(s). |
| 236 | * `context parameters` are the URI query parameters and express contextual |
| 237 | information for selecting resource variants, for example `shard_id=1234&direction=inbound`. |
| 238 | * A `processing directive` provides additional information to the client on how |
| 239 | the URI is to be interpreted. Two supported directives are: |
| 240 | * `alt=<xdstp:// URI>` expressing a fallback URI. |
| 241 | * `entry=<resource name>` providing an anchor referring to an inlined resource |
| 242 | for [list collections](#list). Resource names must be of the form `[a-zA-Z0-9_-\./]+`. |
| 243 | |
| 244 | Multiple directives are comma separated in the fragment component of the URI. |
| 245 | The same directive may not appear more than once in a given URI. |
| 246 | |
| 247 | An example application of the above URI scheme is: |
| 248 | |
| 249 | `xdstp://some.control.plane/envoy.config.route.v3.RouteConfiguration/foo/bar?shard_id=1234&direction=inbound` |
| 250 | |
| 251 | We distinguish between two forms of `xdstp://` URIs: |
| 252 | |
| 253 | * Uniform Resource Locators (URLs) instructing a client on how to locate a given |
| 254 | xDS resource. URLs may include processing directives and [globs](#glob). |
| 255 | |
| 256 | * Uniform Resource Names (URNs) referring to a specific xDS resource. URNs do |
| 257 | not include processing directives or [globs](#glob). `xdstp://` URNs provide |
| 258 | self-contained cache keys. |
| 259 | |
| 260 | #### Proto3 expression |
| 261 | |
| 262 | `xdstp://` URIs are canonically encoded in `proto3` messages. The structure |
| 263 | for this encoding is provided at https://github.com/cncf/xds/tree/main/xds/core/v3: |
| 264 | |
| 265 | * [URL](https://github.com/cncf/xds/blob/main/xds/core/v3/resource_locator.proto) definition |
| 266 | * [URN](https://github.com/cncf/xds/blob/main/xds/core/v3/resource_name.proto) definition |
| 267 | |
| 268 | #### Normalization |
| 269 | |
| 270 | Two `xdstp://` URNs are considered equivalent if they match component-wise |
| 271 | modulo context parameter ordering. |
| 272 | |
| 273 | #### Context parameters |
| 274 | |
| 275 | Context parameters in URNs presented by the client to the server will be |
| 276 | composed from the following sources. Using an example of a URL |
| 277 | `xdstp://some-authority/some.type/foo?bar=baz`: |
| 278 | |
| 279 | * Context parameters from the URL, in the above example |
| 280 | `bar=baz`. These must not be in the `xds.*` namespace. |
| 281 | |
| 282 | * Per-resource type well-known attributes, e.g. an on-demand listener load might |
| 283 | have `{xds.resource.vip: 96.54.3.1}`. These attributes are generated by code, |
| 284 | e.g. an on-demand LDS implementation will first detect the VIP, halt the |
| 285 | request, ask for the `xds.resource.vip` from the control plane, and then |
| 286 | resume the request after discovery is completed. All these attributes will be |
| 287 | `xds.resource.` prefixed. |
| 288 | |
| 289 | An example computed URN following the above example is |
| 290 | `xdstp://some-authority/some.type/foo?bar=baz&xds.resource.vip=96.54.3.1`. |
| 291 | |
| 292 | This proposal reserves all prefixes beginning with a non-alphanumeric character |
| 293 | for context parameter values in future URI context parameter enhancements. |
| 294 | |
| 295 | ### Collections |
| 296 | |
| 297 | Two forms of resources collections are described below, *list* and *glob*. These |
| 298 | different forms reflect the tension between the need for explicit collection |
| 299 | representation (motivating list collections) and scalability concerns as this |
| 300 | explicit representation becomes a bottleneck (motivating [glob](#glob) collections). |
| 301 | |
| 302 | Collections are typically used for LDS, CDS and (planned) LEDS. However, this |
| 303 | list is not exhaustive and future xDS collection types may be added with no |
| 304 | change to the transport protocol. |
| 305 | |
| 306 | #### List |
| 307 | |
| 308 | List collections provide a collection directory as a first-class xDS resource. |
| 309 | For a given xDS resource type `<T>` the list collection type is named by |
| 310 | convention as `<T>Collection` and defined as: |
| 311 | |
| 312 | ``` |
| 313 | message <T>Collection { |
| 314 | repeated CollectionEntry resources = 1; |
| 315 | } |
| 316 | ``` |
| 317 | |
| 318 | where `CollectionEntry` is defined: |
| 319 | |
| 320 | |
| 321 | ``` |
| 322 | message CollectionEntry { |
| 323 | // Inlined resource entry. |
| 324 | message InlineEntry { |
| 325 | // Optional name to describe the inlined resource. Resource names must |
| 326 | // [a-zA-Z0-9_-\./]+. This name allows reference via the #entry directive |
| 327 | // in ResourceLocator. When non-empty, this name must be unique in any give |
| 328 | // list collection. |
| 329 | string name = 1 [(validate.rules).string.pattern = "^[0-9a-zA-Z_\\-\\.~:]+$"]; |
| 330 | |
| 331 | // The resource's logical version. It is illegal to have the same named xDS |
| 332 | // resource name at a given version with different resource payloads. |
| 333 | string version = 2; |
| 334 | |
| 335 | // The resource payload, including type URL. |
| 336 | google.protobuf.Any resource = 3; |
| 337 | } |
| 338 | |
| 339 | oneof resource_specifier { |
| 340 | option (validate.required) = true; |
| 341 | |
| 342 | // A xdstp:// URL describing how the member resource is to be located. |
| 343 | string locator = 1; |
| 344 | |
| 345 | // The resource is inlined in the list collection. |
| 346 | InlineEntry inline_entry = 2; |
| 347 | } |
| 348 | } |
| 349 | ``` |
| 350 | |
| 351 | A simple example of a listener collection fetch sequence: |
| 352 | |
| 353 | 1. Client requests `xdstp://some-authority/envoy.config.listener.v3.ListenerCollection/foo.` |
| 354 | 2. Server responds with a list of resources: `[locator: |
| 355 | xdstp://some-authority/envoy.config.listener.v3.Listener/bar, locator: |
| 356 | xdstp://some-authority/envoy.config.listener.v3.Listener/baz].` |
| 357 | 3. Client requests both |
| 358 | `xdstp://some-authority/envoy.config.listener.v3.Listener/bar `and |
| 359 | `xdstp://some-authority/envoy.config.listener.v3.Listener/baz.` |
| 360 | 4. Server responds with resources contents for |
| 361 | `xdstp://some-authority/envoy.config.listener.v3.Listener/bar `and |
| 362 | `xdstp://some-authority/envoy.config.listener.v3.Listener/baz`. |
| 363 | |
| 364 | This involves two round-trips. Inlining of resources is supported, which can reduce RTT, i.e. |
| 365 | |
| 366 | 1. Client requests `xdstp://some-authority/envoy.config.listener.v3.ListenerCollection/foo.` |
| 367 | 2. Server responds with a collection of literal resources inlined in `foo`: |
| 368 | `[inline_entry: xdstp://some-authority/envoy.config.listener.v3.Listener/bar, |
| 369 | inline_entry: xdstp://some-authority/envoy.config.listener.v3.Listener/baz].` |
| 370 | |
| 371 | Note that in all cases, the context parameters presented in the original request |
| 372 | must be present in the response. For example, a request for |
| 373 | `xdstp://some-authority/envoy.config.listener.v3.ListenerCollection/foo?some=thing`, must |
| 374 | be responded to with a resource named |
| 375 | `xdstp://some-authority/envoy.config.listener.v3.ListenerCollection/foo?some=thing`. |
| 376 | However, individual resources referenced by locator inside the returned list |
| 377 | collection do not need to have the collection-level context parameters included |
| 378 | in their naming. |
| 379 | |
| 380 | #### Glob |
| 381 | |
| 382 | Having explicit collection resources allows delta xDS to provide delta updates |
| 383 | on individual resources but the resource list itself can become a bottleneck for |
| 384 | frequently updated large collections of resources, e.g. with 1M endpoints updating |
| 385 | every 10s. For this situation, we introduce *glob |
| 386 | collections*, which allow the `<T>Collection` directory to be elided when |
| 387 | resources in a collection share a directory structure and a `/*` component is appended to |
| 388 | the resource path. Continuing the previous example, this now looks like: |
| 389 | |
| 390 | 1. Client requests |
| 391 | `xdstp://some-authority/envoy.config.listener.v3.Listener/foo/*`. |
| 392 | 2. Server responds with resources |
| 393 | [`xdstp://some-authority/envoy.config.listener.v3.Listener/foo/bar, |
| 394 | xdstp://some-authority/envoy.config.listener.v3.Listener/foo/baz]`. |
| 395 | |
| 396 | Note that there is no explicit directory sent enumerating `{bar, baz}`. Rather, |
| 397 | glob collections provide delta updates directly on directory resources. |
| 398 | |
| 399 | Globs can exist in arbitrary path locations, e.g. |
| 400 | `xdstp://some-authority/envoy.config.listener.v3.Listener/some/longer/path/*`. |
| 401 | Multiple globs may be subscribed to in a `DeltaDiscoveryRequest`. |
| 402 | |
| 403 | Since each resource returned is subject to independent update via delta xDS and |
| 404 | there is no explicit collection directory to update, glob collections are highly |
| 405 | scalable. For example, consider a collection of 10k resources and the addition |
| 406 | of a single resource. Glob collections will send the single additional resource |
| 407 | (due to the operation of delta xDS). List collections requires that the |
| 408 | collection directory (now containing 10001 resource references) to be sent from |
| 409 | server to client, as well as the additional new resource. |
| 410 | |
| 411 | If no resources are present in the glob collection, the server should reply with a |
| 412 | `DeltaDiscoveryResponse` in which the glob collection URL is specified in |
| 413 | `removed_resources`. |
| 414 | |
| 415 | As with list collections, context parameters in the request must be matched in |
| 416 | responses. A request for |
| 417 | `xdstp://some-authority/envoy.config.listener.v3.Listener/foo/*?some=thing` will |
| 418 | match a resource |
| 419 | `xdstp://some-authority/envoy.config.listener.v3.Listener/foo/bar?some=thing` |
| 420 | but not `xdstp://some-authority/envoy.config.listener.v3.Listener/foo/bar`. |
| 421 | |
| 422 | #### Use cases |
| 423 | |
| 424 | This proposal provides multiple collection mechanisms, as there is a need to |
| 425 | tradeoff ergonomics (i.e. being able to reason about a collection via single |
| 426 | object), performance (i.e. number of round trips) and scalability (e.e. avoiding |
| 427 | a collection directory becoming a bottleneck). |
| 428 | |
| 429 | Some suggested use patterns for the collections are as follows: |
| 430 | |
| 431 | * Federated collections (list collections with references) |
| 432 | * HTTP CDN delivery of configuration (list collections with references) |
| 433 | * Handcrafted configuration on a filesystem (list collections with inline entries) |
| 434 | * Migration of an existing state-of-the-world (SotW) Envoy configuration (list collections with inline entries) |
| 435 | * LEDS and high scalability delta APIs (glob collections) |
| 436 | |
| 437 | For any other use case with a: |
| 438 | |
| 439 | * Small collection of objects or relatively static configuration; |
| 440 | list collections with inline entries are recommended. This is both |
| 441 | performant and requires minimal management server state tracking and round |
| 442 | trips. |
| 443 | * Medium sized collection of objects; list collections with reference entries. |
| 444 | The management server only needs to handle subscribe/unsubscribe state |
| 445 | tracking, since both the collection and its constituent resources are |
| 446 | independent xDS resources. |
| 447 | * For any other use case with a large collection of objects and/or highly |
| 448 | dynamic updates, glob collections are recommended. The management server needs to |
| 449 | provide full delta diffs, since there is no explicit collection object to |
| 450 | inform the client when resources come and go. |
| 451 | |
| 452 | ### Transport network addressing |
| 453 | |
| 454 | An `xdstp://` URI specifies a logic authority and it’s necessary to map to some physical |
| 455 | network address during the resource fetch process. In the existing xDS configuration |
| 456 | fetch configuration, this capability is provided by a `ConfigSource` delivered alongside a |
| 457 | resource name in the xDS resource graph. |
| 458 | |
| 459 | This proposal adds to `ConfigSource` the ability to specify the |
| 460 | authorities for which the `ConfigSource` may be used: |
| 461 | |
| 462 | ``` |
| 463 | message Authority { |
| 464 | string name = 1; |
| 465 | |
| 466 | … when signing is added, items such as CA trust chain, cert pinning … |
| 467 | } |
| 468 | |
| 469 | message ConfigSource { |
| 470 | repeated Authority authorities = N; |
| 471 | |
| 472 | … extant ConfigSource … |
| 473 | } |
| 474 | ``` |
| 475 | |
| 476 | When the `ConfigSource` adjacent to a resource name matches the URI authority, |
| 477 | the `ConfigSource` will continue to be used. |
| 478 | |
| 479 | When there is no match, the xDS client will fallback to the bootstrap to map |
| 480 | from authority to `ConfigSource`. The bootstrap format is client specific, an |
| 481 | example of this is: |
| 482 | |
| 483 | ``` |
| 484 | // List of authorities and config. |
| 485 | repeated ConfigSource xdstp_config_sources = N; |
| 486 | |
| 487 | ``` |
| 488 | |
| 489 | A client may support only static bootstrap configuration of `ConfigSource` for authority mapping. It is |
| 490 | expected that relevant authorities are configured in the bootstrap for referenceable servers. |
| 491 | |
| 492 | To support ADS with multiple control planes, the |
| 493 | [`ApiType`](https://github.com/envoyproxy/envoy/blob/31128e7dc22355876020188bc8feb99304663041/api/envoy/config/core/v3/config_source.proto#L44) |
| 494 | enum in `ApiConfigSource` will be augmented with `AGGREGATED_DELTA_GRPC`. |
| 495 | This will replace and deprecate the existing `ads` field in `ConfigSource`. When |
| 496 | used in `xdstp://` authority resolution, an `ConfigSource` will act as an ADS |
| 497 | transport if configured with this new enum value. Instead of pointing to a |
| 498 | single shared ADS `ConfigSource` declared in the bootstrap, any resource |
| 499 | authority (regardless of type) that maps to a `ConfigSource` with |
| 500 | `AGGREGATED_DELTA_GRPC` will be multiplexed on the xDS stream specified by the |
| 501 | `ConfigSource`. |
| 502 | |
| 503 | ### Discovery request and responses |
| 504 | |
| 505 | Clients are expected to have knowledge ahead of time (via mechanisms not part of |
| 506 | this proposal, e.g. support documentation) on whether the servers specified in |
| 507 | the bootstrap supports the new URI conventions. |
| 508 | |
| 509 | Examples below are provided for delta xDS, but this proposal does not limit |
| 510 | usage to delta xDS. We directionally intend for delta xDS to supplant SotW xDS |
| 511 | over time, the use of inlined entries in list collections allows simple |
| 512 | management servers that do not wish to perform state tracking to perform |
| 513 | state-of-the-world updates. This is achieved by sending the entire state, e.g. |
| 514 | every listener inlined in a `ListenerCollection`. However, migration is |
| 515 | expected to be slow on the uptake and continued SotW support is provided for |
| 516 | this proposal. |
| 517 | |
| 518 | ### Server redirects |
| 519 | |
| 520 | The server may issue redirects by including the following message |
| 521 | in a `Resource` wrapped in the `Any` message: |
| 522 | |
| 523 | ``` |
| 524 | message ResourceLocator { |
| 525 | string resource_locator = 1; |
| 526 | } |
| 527 | ``` |
| 528 | |
| 529 | Redirects are only supported for |
| 530 | list collections. Glob collections may have individual resources redirected but the |
| 531 | collection itself is not redirectable. |
| 532 | |
| 533 | ### Examples |
| 534 | |
| 535 | We provide YAML examples below of discovery request/response sequences for various use cases. |
| 536 | |
| 537 | #### Singleton resource request |
| 538 | |
| 539 | Client `Cluster` resource: |
| 540 | |
| 541 | |
| 542 | ``` |
| 543 | name: some-cluster |
| 544 | eds_cluster_config: |
| 545 | service_name: xdstp://some-authority/envoy.config.endpoint.v3.ClusterLoadAssignment/foo |
| 546 | eds_config: |
| 547 | authorities: |
| 548 | - name: some-authority |
| 549 | … rest of ConfigSource pointing at xDS management server … |
| 550 | ``` |
| 551 | |
| 552 | Client EDS `DeltaDiscoveryRequest` sent to xDS management server: |
| 553 | |
| 554 | |
| 555 | ``` |
| 556 | resource_names_subscribe: |
| 557 | - xdstp://some-authority/envoy.config.endpoint.v3.ClusterLoadAssignment/foo |
| 558 | ``` |
| 559 | |
| 560 | |
| 561 | xDS management server `DeltaDiscoveryResponse` sent to client: |
| 562 | |
| 563 | |
| 564 | ``` |
| 565 | resources: |
| 566 | - version: 1 |
| 567 | name: xdstp://some-authority/envoy.config.endpoint.v3.ClusterLoadAssignment/foo |
| 568 | resource: |
| 569 | "@type": type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment |
| 570 | … foo's ClusterLoadAssignment payload … |
| 571 | ``` |
| 572 | |
| 573 | #### Collection resource requests |
| 574 | |
| 575 | ##### List collections |
| 576 | |
| 577 | Client bootstrap: |
| 578 | |
| 579 | |
| 580 | ``` |
| 581 | dynamic_resources: |
| 582 | lds_resources_locator: |
| 583 | name: xdstp://some-authority/envoy.config.listeners.v3.ListenerCollection/foo |
| 584 | lds_config: |
| 585 | authorities: |
| 586 | - name: some-authority |
| 587 | … rest of ConfigSource pointing at xDS management server … |
| 588 | ``` |
| 589 | |
| 590 | |
| 591 | Client LDS `DeltaDiscoveryRequest` sent to xDS management server: |
| 592 | |
| 593 | |
| 594 | ``` |
| 595 | resource_names_subscribe: |
| 596 | - xdstp://some-authority/envoy.config.listeners.v3.ListenerCollection/foo |
| 597 | ``` |
| 598 | |
| 599 | |
| 600 | xDS management server `DeltaDiscoveryResponse` sent to client: |
| 601 | |
| 602 | |
| 603 | ``` |
| 604 | resources: |
| 605 | - version: 1 |
| 606 | name: xdstp://some-authority/envoy.config.listeners.v3.ListenerCollection/foo |
| 607 | resource: |
| 608 | "@type": type.googleapis.com/envoy.config.listeners.v3.ListenerCollection |
| 609 | - locator: xdstp://some-authority/envoy.config.listeners.v3.Listener/bar |
| 610 | - locator: xdstp://some-authority/envoy.config.listeners.v3.Listener/baz |
| 611 | ``` |
| 612 | |
| 613 | |
| 614 | The `bar` and `baz` resources are then fetched as per [singleton resource |
| 615 | requests](#singleton-resource-request). |
| 616 | |
| 617 | ##### List collections with inlining |
| 618 | |
| 619 | As with the previous list collection example, but rather than returning a list |
| 620 | of URLs in the response, the xDS management server sends to the |
| 621 | client the following `DeltaDiscoveryResponse`: |
| 622 | |
| 623 | |
| 624 | ``` |
| 625 | resources: |
| 626 | - version: 1 |
| 627 | name: xdstp://some-authority/envoy.config.listeners.v3.ListenerCollection/foo |
| 628 | resource: |
| 629 | "@type": type.googleapis.com/envoy.config.listeners.v3.ListenerCollection |
| 630 | - inline_entry: |
| 631 | name: bar |
| 632 | version: 8.5.4 |
| 633 | resource: |
| 634 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 635 | … bar's ClusterLoadAssignment payload … |
| 636 | - inline_entry: |
| 637 | # anonymous resource |
| 638 | version: 3.9.0 |
| 639 | resource: |
| 640 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 641 | … baz's ClusterLoadAssignment payload … |
| 642 | ``` |
| 643 | |
| 644 | |
| 645 | Note that the first resource bar can be referenced in a URI as |
| 646 | `xdstp://some-authority/envoy.config.listeners.v3.ListenerCollection/foo#entry=bar`, |
| 647 | while the second resource is anonymous and cannot be referenced outside the |
| 648 | collection. |
| 649 | |
| 650 | Inlining may be used at the discretion of the management server as a transport |
| 651 | optimization (fewer round-trips). |
| 652 | |
| 653 | ##### Glob collections |
| 654 | |
| 655 | Client bootstrap: |
| 656 | |
| 657 | |
| 658 | ``` |
| 659 | dynamic_resources: |
| 660 | lds_resources_locator: |
| 661 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/my-listeners/*?node_type=ingress |
| 662 | lds_config: |
| 663 | authorities: |
| 664 | - name: some-authority |
| 665 | … rest of ConfigSource pointing at xDS management server … |
| 666 | ``` |
| 667 | |
| 668 | |
| 669 | Client LDS `DeltaDiscoveryRequest` sent to xDS relay proxy (note the use of client capabilities): |
| 670 | |
| 671 | |
| 672 | ``` |
| 673 | resource_names_subscribe: |
| 674 | - xdstp://some-authority/envoy.config.listeners.v3.Listener/my-listeners/*?node_type=ingress |
| 675 | ``` |
| 676 | |
| 677 | xDS management server `DeltaDiscoveryResponse` sent to the client: |
| 678 | |
| 679 | |
| 680 | ``` |
| 681 | resources: |
| 682 | - version: 1 |
| 683 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/my-listeners/foo?node_type=ingress |
| 684 | resource: |
| 685 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 686 | … foo's Listener payload … |
| 687 | - version: 42 |
| 688 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/my-listeners/bar?node_type=ingress |
| 689 | resource: |
| 690 | "@type": type.googleapis.com/xds.core.v3.ResourceLocator |
| 691 | <xdstp://some-authority/envoy.config.listeners.v3.Listener/baz> |
| 692 | ``` |
| 693 | |
| 694 | |
| 695 | In this example, |
| 696 | `xdstp://some-authority/envoy.config.listeners.v3.Listener/my-listeners/bar` was |
| 697 | redirected to `xdstp://some-authority/envoy.config.listeners.v3.Listener/baz.` The |
| 698 | context parameters (ingress, client caps) were used to filter down the listener |
| 699 | set for the client in a given collection (`my-listeners`). |
| 700 | |
| 701 | #### Alternatives |
| 702 | |
| 703 | In this example, a CPaaS wants to specify on-premise control plane resources as |
| 704 | failovers on network partition. |
| 705 | |
| 706 | The CPaaS management server `DeltaDiscoveryResponse` sends to the client inside a `Cluster` resource: |
| 707 | |
| 708 | ``` |
| 709 | name: some-cluster |
| 710 | type: EDS |
| 711 | eds_cluster_config: |
| 712 | service_name: xdstp://some-cloud-authority/envoy.config.endpoint.v3.ClusterLoadAssignment/foo#alt=xdstp://some-onprem-authority/envoy.config.endpoint.v3.ClusterLoadAssignment/bar |
| 713 | eds_config: |
| 714 | authorities: |
| 715 | - name: some-cloud-authority |
| 716 | … rest of ConfigSource pointing at xDS management server … |
| 717 | ``` |
| 718 | |
| 719 | The client has a `ConfigSource for `some-onprem-authority` specified in its |
| 720 | bootstrap. |
| 721 | |
| 722 | Client EDS `DeltaDiscoveryRequest` sends to xDS management server for `some-cloud-authority`: |
| 723 | |
| 724 | |
| 725 | ``` |
| 726 | resource_names_subscribe: |
| 727 | - xdstp://some-cloud-authority/envoy.config.endpoint.v3.ClusterLoadAssignment/foo |
| 728 | ``` |
| 729 | |
| 730 | Under normal conditions, the requested resource is returned as above. If the |
| 731 | config source for `some-cloud-authority` is unreachable, then the client issues |
| 732 | a new `DeltaDiscoveryRequest` to `some-onprem-authority`: |
| 733 | |
| 734 | |
| 735 | ``` |
| 736 | resource_names_subscribe: |
| 737 | - xdstp://some-onprem-authority/envoy.config.endpoint.v3.ClusterLoadAssignment/bar |
| 738 | ``` |
| 739 | |
| 740 | We defer to future xRFCs details on how failover, retry and recover occur. |
| 741 | |
| 742 | #### xDS relay proxy |
| 743 | |
| 744 | In this example, two clients work with an xDS relay proxy to receive their |
| 745 | configuration from some canonical xDS server. |
| 746 | |
| 747 | Client A bootstrap: |
| 748 | |
| 749 | |
| 750 | ``` |
| 751 | dynamic_resources: |
| 752 | lds_resources_locator: |
| 753 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/a-listeners/* |
| 754 | lds_config: |
| 755 | authorities: |
| 756 | - name: some-authority |
| 757 | … rest of ConfigSource pointing at xDS relay proxy … |
| 758 | ``` |
| 759 | |
| 760 | |
| 761 | Client A LDS `DeltaDiscoveryRequest` sent to xDS relay proxy: |
| 762 | |
| 763 | |
| 764 | ``` |
| 765 | resource_names_subscribe: |
| 766 | - xdstp://some-authority/envoy.config.listeners.v3.Listener/a-listeners/* |
| 767 | ``` |
| 768 | |
| 769 | Client B bootstrap: |
| 770 | |
| 771 | |
| 772 | ``` |
| 773 | dynamic_resources: |
| 774 | lds_resources_locator: |
| 775 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/b-listeners/* |
| 776 | lds_config: |
| 777 | authorities: |
| 778 | - mame: some-authority |
| 779 | … rest of ConfigSource pointing at xDS relay proxy … |
| 780 | ``` |
| 781 | |
| 782 | Client B LDS `DiscoveryRequest` sent to xDS relay proxy: |
| 783 | |
| 784 | |
| 785 | ``` |
| 786 | resource_names_subscribe: |
| 787 | - xdstp://some-authority/envoy.config.listeners.v3.Listener/b-listeners/* |
| 788 | ``` |
| 789 | |
| 790 | |
| 791 | xDS relay proxy `DeltaDiscoveryRequest` sent to some `some-authority`: |
| 792 | |
| 793 | |
| 794 | ``` |
| 795 | resources_names_subscribe: |
| 796 | - xdstp://some-authority/envoy.config.listeners.v3.Listener/a-listeners/* |
| 797 | - xdstp://some-authority/envoy.config.listeners.v3.Listener/b-listeners/* |
| 798 | ``` |
| 799 | |
| 800 | |
| 801 | The origin for `some-authority` replies with a `DeltaDiscoveryResponse` sent to |
| 802 | xDS relay proxy: |
| 803 | |
| 804 | |
| 805 | ``` |
| 806 | resources: |
| 807 | - version: 1 |
| 808 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/a-listeners/foo |
| 809 | resource: |
| 810 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 811 | … foo's Listener payload … |
| 812 | - version: 42 |
| 813 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/a-listeners/bar |
| 814 | resource: |
| 815 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 816 | … bar's Listener payload … |
| 817 | - version: 13 |
| 818 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/b-listeners/baz |
| 819 | resource: |
| 820 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 821 | … baz's Listener payload … |
| 822 | ``` |
| 823 | |
| 824 | xDS relay proxy `DeltaDiscoveryResponse` sent to client A: |
| 825 | |
| 826 | ``` |
| 827 | resources: |
| 828 | - version: 1 |
| 829 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/a-listeners/foo |
| 830 | resource: |
| 831 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 832 | … foo's Listener payload … |
| 833 | - version: 42 |
| 834 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/a-listeners/bar |
| 835 | resource: |
| 836 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 837 | … bar's Listener payload … |
| 838 | ``` |
| 839 | |
| 840 | xDS relay proxy `DeltaDiscoveryResponse` sent to client B: |
| 841 | |
| 842 | ``` |
| 843 | resources: |
| 844 | - version: 13 |
| 845 | name: xdstp://some-authority/envoy.config.listeners.v3.Listener/b-listeners/baz |
| 846 | resource: |
| 847 | "@type": type.googleapis.com/envoy.config.listeners.v3.Listener |
| 848 | … baz's Listener payload … |
| 849 | ``` |
| 850 | |
| 851 | ## Rationale |
| 852 | |
| 853 | N/A |
| 854 | |
| 855 | |
| 856 | ## Implementation |
| 857 | |
| 858 | N/A |