From 2e439c1595cbb00bbe24c2795a531c6999a556d7 Mon Sep 17 00:00:00 2001 From: John Murret Date: Fri, 22 Dec 2023 08:22:42 -0700 Subject: [PATCH] NET-6944 - Replace usage of deprecated Envoy field envoy.extensions.filters.http.lua.v3.Lua.inline_code --- .changelog/20012.txt | 3 +++ agent/envoyextensions/builtin/lua/lua.go | 7 ++++++- .../listeners/lambda-and-lua-connect-proxy.latest.golden | 4 +++- .../lua-inbound-applies-to-inbound.latest.golden | 4 +++- ...-inbound-doesnt-apply-to-local-upstreams.latest.golden | 4 +++- ...tbound-applies-to-local-upstreams-tproxy.latest.golden | 8 ++++++-- .../lua-outbound-applies-to-local-upstreams.latest.golden | 4 +++- 7 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 .changelog/20012.txt diff --git a/.changelog/20012.txt b/.changelog/20012.txt new file mode 100644 index 0000000000000..6f9cc45556518 --- /dev/null +++ b/.changelog/20012.txt @@ -0,0 +1,3 @@ +```release-note:improvement +xds: replace usage of deprecated Envoy field `envoy.extensions.filters.http.lua.v3.Lua.inline_code` +``` diff --git a/agent/envoyextensions/builtin/lua/lua.go b/agent/envoyextensions/builtin/lua/lua.go index ba08d9d286c01..91e912842ef41 100644 --- a/agent/envoyextensions/builtin/lua/lua.go +++ b/agent/envoyextensions/builtin/lua/lua.go @@ -6,6 +6,7 @@ package lua import ( "errors" "fmt" + envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" envoy_lua_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/lua/v3" @@ -97,7 +98,11 @@ func (l *lua) PatchFilter(p extensioncommon.FilterPayload) (*envoy_listener_v3.F luaHttpFilter, err := extensioncommon.MakeEnvoyHTTPFilter( "envoy.filters.http.lua", &envoy_lua_v3.Lua{ - InlineCode: l.Script, + DefaultSourceCode: &envoy_core_v3.DataSource{ + Specifier: &envoy_core_v3.DataSource_InlineString{ + InlineString: l.Script, + }, + }, }, ) if err != nil { diff --git a/agent/xds/testdata/builtin_extension/listeners/lambda-and-lua-connect-proxy.latest.golden b/agent/xds/testdata/builtin_extension/listeners/lambda-and-lua-connect-proxy.latest.golden index bf09509b375db..bd8c7b3f952e9 100644 --- a/agent/xds/testdata/builtin_extension/listeners/lambda-and-lua-connect-proxy.latest.golden +++ b/agent/xds/testdata/builtin_extension/listeners/lambda-and-lua-connect-proxy.latest.golden @@ -202,7 +202,9 @@ "name": "envoy.filters.http.lua", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua", - "inlineCode": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + "defaultSourceCode": { + "inlineString": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + } } }, { diff --git a/agent/xds/testdata/builtin_extension/listeners/lua-inbound-applies-to-inbound.latest.golden b/agent/xds/testdata/builtin_extension/listeners/lua-inbound-applies-to-inbound.latest.golden index f0b2d4684088a..7dec626a708ad 100644 --- a/agent/xds/testdata/builtin_extension/listeners/lua-inbound-applies-to-inbound.latest.golden +++ b/agent/xds/testdata/builtin_extension/listeners/lua-inbound-applies-to-inbound.latest.golden @@ -157,7 +157,9 @@ "name": "envoy.filters.http.lua", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua", - "inlineCode": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + "defaultSourceCode": { + "inlineString": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + } } }, { diff --git a/agent/xds/testdata/builtin_extension/listeners/lua-inbound-doesnt-apply-to-local-upstreams.latest.golden b/agent/xds/testdata/builtin_extension/listeners/lua-inbound-doesnt-apply-to-local-upstreams.latest.golden index 3b2dab64b526a..b3d6800760fd1 100644 --- a/agent/xds/testdata/builtin_extension/listeners/lua-inbound-doesnt-apply-to-local-upstreams.latest.golden +++ b/agent/xds/testdata/builtin_extension/listeners/lua-inbound-doesnt-apply-to-local-upstreams.latest.golden @@ -193,7 +193,9 @@ "name": "envoy.filters.http.lua", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua", - "inlineCode": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + "defaultSourceCode": { + "inlineString": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + } } }, { diff --git a/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams-tproxy.latest.golden b/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams-tproxy.latest.golden index 0b349be9433bd..d0ea17f3f1fac 100644 --- a/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams-tproxy.latest.golden +++ b/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams-tproxy.latest.golden @@ -49,7 +49,9 @@ "name": "envoy.filters.http.lua", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua", - "inlineCode": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + "defaultSourceCode": { + "inlineString": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + } } }, { @@ -93,7 +95,9 @@ "name": "envoy.filters.http.lua", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua", - "inlineCode": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + "defaultSourceCode": { + "inlineString": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + } } }, { diff --git a/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams.latest.golden b/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams.latest.golden index ade1593e2eabd..a35d2bc30c554 100644 --- a/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams.latest.golden +++ b/agent/xds/testdata/builtin_extension/listeners/lua-outbound-applies-to-local-upstreams.latest.golden @@ -21,7 +21,9 @@ "name": "envoy.filters.http.lua", "typedConfig": { "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua", - "inlineCode": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + "defaultSourceCode": { + "inlineString": "\nfunction envoy_on_request(request_handle)\n request_handle:headers():add(\"test\", \"test\")\nend" + } } }, {