Skip to content

Gateway context in Translation hook #5561

Closed

Description

@muwaqar

Description:
The current xDS Translation hook has an empty context.

Sometimes some mutation needs to be done on Clusters based on Gateway policies. For example, if a Gateway supports mTLS via SPIFFE, we want to be able to add a SPIRE agent as an upstream cluster.

Currently it is not possible to know which Gateway xDS is being mutated so this conditional mutation is not possible.

EG already does a great job of custom Gateway policy attachments that it passes to the Listener modification hook. The proposal here is to pass the ExtensionResource(s) attached for the Gateway to the Translation hook as well.

[optional Relevant Links:]

Any extra documentation required to understand the issue.

Activity

  1. guydc commented on Mar 25, 2025

    @guydc
    Contributor
  2. github-actions commented on Apr 25, 2025

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had activity in the last 30 days.

  3. guydc commented on Apr 25, 2025

    @guydc
    Contributor

    Hi @muwaqar. WDYT about adding a cluster streaming hook that will have ExtensionRef HTTPRouteFilter context from the BackendRef filters, similar to how route rule HTTPRouteFilter drive xds route mutation in extension service?

    https://gateway-api.sigs.k8s.io/reference/spec/#httpbackendref

    For example:

    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      namespace: default
      name: httproute-1
    spec:
      hostnames:
      - gateway.envoyproxy.io
      parentRefs:
      - namespace: envoy-gateway
        name: gateway-1
        sectionName: http
      rules:
      - matches:
        - path:
            value: "/"
        backendRefs:
         - name: service-1
           port: 8080
           filters:
           - type: ExtensionRef
             extensionRef:
               group: foo.example.io
               kind: Foo
               name: example
         - name: service-2
           port: 8080
           filters:
           - type: ExtensionRef
             extensionRef:
               group: foo.example.io
               kind: Foo
               name: example2
    ---
    apiVersion: foo.example.io/v1alpha1
    kind: Foo
    metadata:
      name: example
      namespace: default
    spec:
      spiffeeTLSContext:
        certificateSource:
           certName: envoy-gateway-client-cert
           spireSDSClusterName: my-spire
         trustStoreSource:
            caName: 
            spireSDSClusterName: my-spire
    ---
    apiVersion: foo.example.io/v1alpha1
    kind: Foo
    metadata:
      name: example2
      namespace: default
    spec:
      preConnectPolicy:
         ratio: 42     

    The extension server is called with a new hook (PostClusterModify) with the generted cluster and the two filters as context.

  4. pinned this issue on Apr 25, 2025
  5. unpinned this issue on Apr 25, 2025
  6. guydc commented on Apr 25, 2025

    @guydc
    Contributor

    After carefully re-reading your request, this does not solve the problem of adding the SPIRE cluster itself. Rather, it facilitates conditional and contextual mutation of specific clusters that use SPIRE.

  7. github-actions commented on May 26, 2025

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had activity in the last 30 days.

  8. muwaqar commented on Jun 9, 2025

    @muwaqar
    ContributorAuthor

    closing this since #5914 is completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions