Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Route and VHost Metadata #3318

Closed
guydc opened this issue May 2, 2024 · 7 comments
Closed

Support Route and VHost Metadata #3318

guydc opened this issue May 2, 2024 · 7 comments
Labels
area/api API-related issues area/extensions area/observability Observability related issues

Comments

@guydc
Copy link
Contributor

guydc commented May 2, 2024

Description:
In Envoy, static metadata can be configured on virtual hosts, routes, clusters, etc.

Static metadata can be used for various purposes:

In the context of Envoy Gateway, route metadata can be beneficial for observability and configuration of custom data-plane extensions, as described above.

Envoy gateway can support route metadata using:

  • A vendor-specific Gateway API HTTP Route Filter. This is possibly a misuse of the filter mechanism, since there is no additional processing of traffic.
  • A new or existing Envoy Gateway Policy
  • An extended Gateway API HTTPRoute resources that supports route metadata, e.g. using annotations.
@guydc guydc added triage area/api API-related issues area/extensions area/observability Observability related issues and removed triage labels May 2, 2024
@Alice-Lilith
Copy link
Member

💯 This type of stuff is super useful to get metadata per route or per ext_authz filter, etc. Makes it a lot easier to provide context about things like:

  • Team that owns/maintains some routes/services/APIs
  • Pass info over to an ext_authz filter

@guydc
Copy link
Contributor Author

guydc commented May 15, 2024

During the community meeting, the following proposal was raised:

  • Use K8s resource annotations to store metadata
  • Support per-route-rule metadata, leveraging httprouterule.name introduced in GEP-995 as a rule id, allowing rules to be referenced.

For example:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: http-app-1
  annotations:
    route.metadata.gateway.envoyproxy.io/rules: | 
      rules: 
      - rule1:
         team: ops
         app: commerce
spec:
  parentRefs:
  - name: my-gateway
  hostnames:
  - "foo.com"
  rules:
  - matches:
    name: rule1
    - path:
        type: PathPrefix
        value: /bar
    backendRefs:
    - name: my-service1
      port: 8080

Will lead to the generated xds route corresponding to rule1 to have the following static metadata : {gateway.envoyproxy.io: {ruleName: rule1, team: ops, app: commerce}}. Note that the GEP-995 route ruleName is also propagated as route metadata.

This approach has several limitations:

  • Annotation size is limited to 262144 bytes.
  • Confidential configuration should not be stored in annotations.
  • Using annotations to implement features is somewhat of an anti-pattern in the Gateway-API ecosystem.

@arkodg
Copy link
Contributor

arkodg commented May 15, 2024

+1 for mapping Gateway API fields ( like Kind, Name, Namespace and Annotations) into Xds resources, which can be then used for enriching telemetry such as access logs.
3 open questions here are

  • which Gateway API fields to use as input
  • Mapping Gateway API to IR to xDS config
  • Is Telemetry and other enrichment default or opt in

@guydc
Copy link
Contributor Author

guydc commented Jun 10, 2024

which Gateway API fields to use as input

  • K8s meta: Name, Namespace, Kind, Annotations. Only annotations from a specific namespace will be copied (e.g. gateway.envoyproxy.io/key : value).
  • Meaningful Gateway API fields like "section names": Listener name, Route rule name, port name
  • Open to future extension, e.g. supporting GW-API annotations (like gateway annotations).

Mapping Gateway API to IR to xDS config

In high level, I think that the following makes sense:

  • GWC/GW => Listener Metadata
  • Listener => VHost Metadata
  • xRoute => Route(s) Metadata
  • Service/Backend => Cluster Metadata

Of course, we don't have to implement everything immediately.

Is Telemetry and other enrichment default or opt in

Since annotations are filtered and the other metadata is constrained in size, I think that adding the relevant Listener/Route/Cluster metadata will not inflate XDS too much. Users can decide if they want to add this metadata to their access logs and/or other telemetry.

WDYT?

@arkodg
Copy link
Contributor

arkodg commented Jun 11, 2024

+1 to this @guydc

@guydc
Copy link
Contributor Author

guydc commented Jun 25, 2024

note: VHost metadata, which is a reasonable target for GW/Listener metadata, is currently not accessible for access logger/attribute consuming extensions: envoyproxy/envoy#34900. However, it can still be beneficial to annotate Vhosts for blame tooling like #3648.

@guydc guydc changed the title Support Route Metadata Support Route and VHost Metadata Jun 25, 2024
@guydc
Copy link
Contributor Author

guydc commented Jul 11, 2024

closed with: #3602

@guydc guydc closed this as completed Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api API-related issues area/extensions area/observability Observability related issues
Projects
None yet
Development

No branches or pull requests

3 participants