Skip to content

Support HTTPRoute filters on auto-created canary HTTPRoutes (Gateway API) #1888

@jkotiuk

Description

@jkotiuk

Describe the feature

When using provider: gatewayapi:v1, Flagger auto-creates HTTPRoutes for canary traffic splitting. Currently there's no way to attach Gateway API filters to these auto-created HTTPRoutes — most importantly ExtensionRef filters that reference implementation-specific resources (e.g. NGINX Gateway Fabric's SnippetsFilter).

ExtensionRef support is the most critical gap — it's the Gateway API mechanism for implementation-specific behavior that has no equivalent in the Canary spec. Other filter types (RequestHeaderModifier, RequestRedirect, etc.) have partial equivalents via headers, rewrite, etc., but ExtensionRef has none.

This is a blocker for migrating canaries from provider: nginx (Ingress-based) to provider: gatewayapi:v1 when routes require implementation-specific behavior like auth subrequests, custom headers, or CORS that can't be expressed through the existing Canary spec fields.

Proposed solution

Add an optional filters field to the Canary service spec that gets propagated to the auto-created HTTPRoute rules:

apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
  name: my-app
spec:
  provider: "gatewayapi:v1"
  service:
    gatewayRefs:
      - name: my-gateway
        namespace: gateway-ns
    filters:
      - type: ExtensionRef
        extensionRef:
          group: gateway.nginx.org
          kind: SnippetsFilter
          name: my-auth-filter

This would allow the generated HTTPRoute rules to include these filters alongside Flagger's traffic-splitting backendRefs.

Use case

We're migrating from Ingress-based canaries (provider: nginx) to Gateway API (provider: gatewayapi:v1) with NGINX Gateway Fabric. Our Ingress routes use auth_request annotations for authentication subrequests. With Gateway API, this is handled via SnippetsFilter resources attached as ExtensionRef on HTTPRoute rules.

Since Flagger's auto-created HTTPRoute has no filters, the canary route has no authentication — which is a security concern. The current workaround is applying auth at the gateway listener level (via SnippetsPolicy), but this is coarse-grained and not always appropriate.

Alternatives considered

  • SnippetsPolicy at listener level: Works but applies auth to ALL routes on the listener, requiring auth_request off overrides on routes that shouldn't have auth. Not ideal when multiple services with different auth requirements share a listener.
  • Manually patching Flagger's auto-created HTTPRoute: Flagger overwrites it on every reconciliation.

Environment

  • Flagger version: 1.40.0
  • Gateway API provider: gatewayapi:v1
  • Gateway implementation: NGINX Gateway Fabric

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions