Skip to content

GRPCRoutes panic the controller translator when RequestMirror filter is used #6874

@AndyMoreland

Description

@AndyMoreland

Description:

GRPCRoutes panic the translator if they specify a requestMirror filter

Repro steps:

gateways:
- apiVersion: gateway.networking.k8s.io/v1
  kind: Gateway
  metadata:
    namespace: envoy-gateway
    name: gateway-1
  spec:
    gatewayClassName: envoy-gateway-class
    listeners:
    - name: http
      protocol: HTTP
      port: 80
      allowedRoutes:
        namespaces:
          from: All
grpcRoutes:
- apiVersion: gateway.networking.k8s.io/v1alpha2
  kind: GRPCRoute
  metadata:
    namespace: default
    name: grpcroute-1
  spec:
    parentRefs:
    - namespace: envoy-gateway
      name: gateway-1
      sectionName: http
    rules:
    - matches:
      - headers:
        - type: Exact
          name: magic
          value: foo
      backendRefs:
      - name: service-1
        port: 8080
      filters:
        - type: RequestMirror
          requestMirror:
            backendRef:
                kind: Service
                name: service-2
                port: 8080

Environment:

Present in main, but at least since 1.4.1; EKS in this case, but repros on local macos machine as well.

Logs:

From 1.4.1 --

observed a panic	{"runner": "gateway-api", "stackTrace": "goroutine 257 [running]:
runtime/debug.Stack()
\t/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/debug/stack.go:26 +0x5e
github.com/envoyproxy/gateway/internal/message.handleWithCrashRecovery[...].func1()
\t/home/runner/work/gateway/gateway/internal/message/watchutil.go:54 +0x1fe
panic({0x33e0920?, 0xc009ffc1b0?})
\t/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/panic.go:792 +0x132
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).validateBackendRefFilters(0xc0033a58f0, {0x35d6120?, 0xc0024ab310?}, {0x2faa625, 0x9})
\t/home/runner/work/gateway/gateway/internal/gatewayapi/validate.go:111 +0x485
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).validateBackendRef(0xc0033a58f0, {0x35d6120, 0xc0024ab310}, {0x8b5c5f0, 0xc0087000e0}, 0xc003c29188, {0xc0061a3620, 0x11}, {0x2faa625, 0x9})
\t/home/runner/work/gateway/gateway/internal/gatewayapi/validate.go:33 +0x97
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).processDestination(0xc0033a58f0, {0xc003b98620, 0x69}, {0x35d6120, 0xc0024ab310}, 0xc0024ab270, {0x8b5c5f0, 0xc0087000e0}, 0xc003c29188)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/route.go:1383 +0x16f
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).processRequestMirrorFilter(0xc0033a58f0, 0x0, 0xc005915e40, 0xc009ffc0c0, 0xc003c29188)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/filters.go:958 +0x408
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).ProcessGRPCFilters(0xc0033a58f0, 0xc0024ab270, {0x8b5c5f0, 0xc0087000e0}, {0xc007b4bc20, 0x1, 0x38645a0?}, 0xc003c29188)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/filters.go:150 +0x238
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).processGRPCRouteRules(0xc0033a58f0, 0xc0087000e0, 0xc0024ab270, 0xc003c29188)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/route.go:641 +0x192
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).processGRPCRouteParentRefs(0xc0033a58f0, 0xc0087000e0, 0xc003c29188, 0xc00821cde0)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/route.go:573 +0xd6
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).ProcessGRPCRoutes(0xc0033a58f0, {0xc004663880, 0xb, 0x20?}, {0xc009b81aa0, 0x1, 0x1}, 0xc003c29188, 0xc00821cde0)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/route.go:111 +0x233
github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).Translate(0xc0033a58f0, 0xc003c29188)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/translator.go:195 +0x27e
github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).subscribeAndTranslate.func1({{0xc00173a9f0?, 0x47dac5749611dfbe?}, 0x80?, 0xc006636150?}, 0xc002290000)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:177 +0x51e
github.com/envoyproxy/gateway/internal/message.handleWithCrashRecovery[...](0xc00ad9bfa0?, {{0xc00173a9f0, 0x663324?}, 0xb2?, 0xc006636150?}, {{0x3ad5163, 0xb}, {0x3ae891d, 0x12}}, 0xc002290000?)
\t/home/runner/work/gateway/gateway/internal/message/watchutil.go:60 +0x137
github.com/envoyproxy/gateway/internal/message.HandleSubscription[...]({{0x3ad5163, 0xc001c01340?}, {0x3ae891d?, 0xc000f70fa8?}}, 0xc002fd4850?, 0xc0033a5fa0)
\t/home/runner/work/gateway/gateway/internal/message/watchutil.go:99 +0x7b0
github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).subscribeAndTranslate(0xc000b6bae0, 0x3333332133333332?)
\t/home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:127 +0x50
created by github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).Start in goroutine 24
\t/home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:90 +0x34d
", "error": "interface conversion: interface {} is []v1.HTTPRouteFilter, not []v1.GRPCRouteFilter"}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions