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 Metadata #3318

Open
guydc opened this issue May 2, 2024 · 3 comments
Open

Support Route Metadata #3318

guydc opened this issue May 2, 2024 · 3 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
@AliceProxy
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

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