Skip to content

Envoy xDS metadata for Cluster and LocalityLbEndpoints resources #5523

@muwaqar

Description

@muwaqar

Description:
Currently EnvoyGateway propagates xDS metadata for Route and VirtualHost resources, but not for Cluster and LbEndpoints.

Note that the main documentation page for this feature currently says the following:

Service, ServiceImport and Backend metadata and port name are propagated to envoy cluster metadata.

This is incorrect, as evident from the code since buildXdsCluster() never sets any metadata.

The proposal in this ticket is to:

  1. Route metadata be propagated to Cluster xDS.

Each *RouteRule creates a distinct xDS cluster which encapsulates upstream endpoints of its backendRefs.

Accordingly, maybe we can put the *Route metadata into the Cluster xDS?

For example:

For a HTTPRoute as:

kind: HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
metadata:
  annotations:
    gateway.envoyproxy.io/foo: bar
  name: myroute
  namespace: myns
spec:
  rules:
    matches:
    - path:
        type: PathPrefix
        value: /mypath

we get:

name: httproute/myns/myroute/rule/0
type: CDS
[...]
metadata:
  filter_metadata:
    envoy-gateway:
      resources:
        - namespace: myns
          groupVersion: gateway.networking.k8s.io/v1
          kind: HTTPRoute
          annotations:
            foo: bar
          name: myroute
  1. BackendReference (Service, ServiceImport, Backend) metadata be propagated to LocalityLbEndpoints xDS.

If a *RouteRule contains multiple BackendReference, each of these are modeled as separate LocalityLbEndpoints.

Accordingly, maybe we can put the BackendReference metadata into the LocalityLbEndpoints xDS?

For example:

For a HTTPRoute as:

kind: HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
metadata:
  annotations:
    gateway.envoyproxy.io/foo: bar
  name: myroute
  namespace: myns
spec:
  rules:
    - backendRefs:
      - group: ""
         kind: Service
         name: svc-1
         port: 3000
       - group: ""
         kind: Service
         name: svc-2
         port: 3000  

we get:

clusterName: httproute/myns/myroute/rule/0
endpoints:
- lbEndpoints:
  - endpoint:
      address:
      [...]
  locality:
    region: httproute/myns/myroute/rule/0/backend/0
  metadata:
    filter_metadata:
      envoy-gateway:
        resources:
          - namespace: myns
            groupVersion: ""
            kind: Service
            name: svc-1
- lbEndpoints:
  - endpoint:
      address:
      [...]
  locality:
    region: httproute/myns/myroute/rule/0/backend/1
  metadata:
      filter_metadata:
        envoy-gateway:
          resources:
            - namespace: myns
              groupVersion: ""
              kind: Service
              name: svc-2

[optional Relevant Links:]

The feature is documented at https://gateway.envoyproxy.io/contributions/design/metadata/.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions