From 30aa410eebc088d18823de061bd3b51307fadee7 Mon Sep 17 00:00:00 2001 From: Guy Daich Date: Thu, 22 May 2025 14:44:19 -0500 Subject: [PATCH] return early from buildwasms Signed-off-by: Guy Daich --- .../testdata/translate/out/backend-endpoint.all.yaml | 4 +--- internal/gatewayapi/envoyextensionpolicy.go | 8 ++++++-- release-notes/current.yaml | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/cmd/egctl/testdata/translate/out/backend-endpoint.all.yaml b/internal/cmd/egctl/testdata/translate/out/backend-endpoint.all.yaml index e9816d3458..1e913ac3da 100644 --- a/internal/cmd/egctl/testdata/translate/out/backend-endpoint.all.yaml +++ b/internal/cmd/egctl/testdata/translate/out/backend-endpoint.all.yaml @@ -77,9 +77,7 @@ envoyExtensionPolicies: namespace: envoy-gateway-system conditions: - lastTransitionTime: null - message: |- - Wasm: wasm cache is not initialized - ExtProc: service envoy-gateway-system/grpc-ext-proc not found. + message: 'ExtProc: service envoy-gateway-system/grpc-ext-proc not found.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/envoyextensionpolicy.go b/internal/gatewayapi/envoyextensionpolicy.go index 7b27adbf06..079fdced28 100644 --- a/internal/gatewayapi/envoyextensionpolicy.go +++ b/internal/gatewayapi/envoyextensionpolicy.go @@ -614,12 +614,16 @@ func (t *Translator) buildWasms( policy *egv1a1.EnvoyExtensionPolicy, resources *resource.Resources, ) ([]ir.Wasm, error) { + var wasmIRList []ir.Wasm + + if len(policy.Spec.Wasm) == 0 { + return wasmIRList, nil + } + if t.WasmCache == nil { return nil, fmt.Errorf("wasm cache is not initialized") } - var wasmIRList []ir.Wasm - if policy == nil { return nil, nil } diff --git a/release-notes/current.yaml b/release-notes/current.yaml index 8f4ef39f41..d704edba96 100644 --- a/release-notes/current.yaml +++ b/release-notes/current.yaml @@ -15,6 +15,7 @@ new features: | Added XDS metadata for clusters and endpoints from xRoutes and referenced backend resources (Backend, Service, ServiceImport). bug fixes: | + Fixed issue where WASM cache init failure caused routes with WASM-less EnvoyExtensionPolicies to have 500 direct responses. # Enhancements that improve performance. performance improvements: |