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

Envoy Gateway pod crashes when mergeGateway is enabled #2661

Closed
yaelSchechter opened this issue Feb 20, 2024 · 3 comments
Closed

Envoy Gateway pod crashes when mergeGateway is enabled #2661

yaelSchechter opened this issue Feb 20, 2024 · 3 comments
Assignees
Labels
area/translator Issues related to Gateway's translation service, e.g. translating Gateway APIs into the IR. kind/bug Something isn't working

Comments

@yaelSchechter
Copy link
Contributor

yaelSchechter commented Feb 20, 2024

Description:
When creating a ClientTrafficPolicy and enabling the MergeGateways flag, the Envoy-Gateway pod crashes with a nil-pointer exception. Upon investigation, it was found that the crash occurs during translating the clientTrafficPolicy to a listener, as the key used to look up the xdsIR map is the namespaced name of the clientTrafficPolicy here.

However, during the initIR function the key assigned to this clientTrafficPolicy is the GatewayClass name when the MergeGateways is enabled (here).

The MergeGateways field should be taken into account during the xdsIR map lookup.

Repro steps:

Gateway:

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: gateway
  namespace: envoy-gateway
spec:
  gatewayClassName: gateway-class
  listeners:
    - name: https
      protocol: HTTPS
      port: 443

ClientTrafficPolicy:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
  name: ctp
  namespace: envoy-gateway
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: Gateway
    name: gateway
  ...

EnvoyProxy:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
  name: custom-proxy-config
  namespace: envoy-gateway-system
spec:
  mergeGateways: true
  ...

Logs:

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1d32e1a] goroutine 265 [running]: github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).translateClientTrafficPolicyForListener(0x2486400?, 0xc000f90108, 0xc0009cb880, 0x1?, 0x24d8960?) 	/home/runner/work/gateway/gateway/internal/gatewayapi/clienttrafficpolicy.go:303 +0x1da github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).ProcessClientTrafficPolicies(0xc000fdb0d0?, {0xc000600768, 0x1, 0x1}, {0xc000600818, 0x1, 0x1}, 0x1e29cab?, 0x30ca5c6?) 	/home/runner/work/gateway/gateway/internal/gatewayapi/clienttrafficpolicy.go:183 +0x96b github.com/envoyproxy/gateway/internal/gatewayapi.(*Translator).Translate(0x289e418?, 0xc00074ec40) 	/home/runner/work/gateway/gateway/internal/gatewayapi/translator.go:155 +0x145 github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).subscribeAndTranslate.func1({{0xc0006e5b66?, 0x0?}, 0x10?, 0xc00074ec40?}, 0x44dd65?) 	/home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:78 +0x17f github.com/envoyproxy/gateway/internal/message.HandleSubscription[...]({{0x252f85f, 0x2899cf8?}, {0x253c8b4?, 0x2498020?}}, 0xc0006186c0?, 0xc000fdbf98) 	/home/runner/work/gateway/gateway/internal/message/watchutil.go:76 +0x112d github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).subscribeAndTranslate(0xc0003f6400, {0x2899cf8?, 0xc00069c9b0?}) 	/home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:51 +0x85 created by github.com/envoyproxy/gateway/internal/gatewayapi/runner.(*Runner).Start in goroutine 1 	/home/runner/work/gateway/gateway/internal/gatewayapi/runner/runner.go:45 +0x26e ➜  ~ kubectl logs -n envoy-gateway-system envoy-gateway-55658bb7c-md5js
@yaelSchechter yaelSchechter changed the title Envoy-Gateway pod crashes when mergeGateway is enabled Envoy Gateway pod crashes when mergeGateway is enabled Feb 20, 2024
@cnvergence cnvergence added kind/bug Something isn't working area/translator Issues related to Gateway's translation service, e.g. translating Gateway APIs into the IR. and removed triage labels Feb 20, 2024
@cnvergence
Copy link
Member

thanks @yaelSchechter for reporting, it is missing the correct key

@zirain
Copy link
Member

zirain commented Feb 21, 2024

@cnvergence fixed by #2662 ?

@cnvergence
Copy link
Member

yes, we can close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/translator Issues related to Gateway's translation service, e.g. translating Gateway APIs into the IR. kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants