From a670bc8588f1bbfedb20d9ff25e72146e602804d Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Wed, 10 Jul 2024 12:57:01 -0700 Subject: [PATCH] fix(wasm): re-enable Lua DNS resolver for proxy-wasm This was previously disabled in 9a5d48bfca. --- .../kong/fix-wasm-enable-pwm-lua-resolver.yml | 4 ++++ kong/conf_loader/init.lua | 3 +-- spec/01-unit/04-prefix_handler_spec.lua | 10 +--------- spec/02-integration/20-wasm/04-proxy-wasm_spec.lua | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) create mode 100644 changelog/unreleased/kong/fix-wasm-enable-pwm-lua-resolver.yml diff --git a/changelog/unreleased/kong/fix-wasm-enable-pwm-lua-resolver.yml b/changelog/unreleased/kong/fix-wasm-enable-pwm-lua-resolver.yml new file mode 100644 index 000000000000..8099909ba915 --- /dev/null +++ b/changelog/unreleased/kong/fix-wasm-enable-pwm-lua-resolver.yml @@ -0,0 +1,4 @@ +message: | + Re-enabled the Lua DNS resolver from proxy-wasm by default. +type: bugfix +scope: Configuration diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index 13b908dc4c3c..48a893e2ed79 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -640,8 +640,7 @@ local function load(path, custom_conf, opts) -- set it as such in kong_defaults, because it can only be used if wasm is -- _also_ enabled. We inject it here if the user has not opted to set it -- themselves. - -- TODO: as a temporary compatibility fix, we are forcing it to 'off'. - add_wasm_directive("nginx_http_proxy_wasm_lua_resolver", "off") + add_wasm_directive("nginx_http_proxy_wasm_lua_resolver", "on") -- configure wasmtime module cache if conf.role == "traditional" or conf.role == "data_plane" then diff --git a/spec/01-unit/04-prefix_handler_spec.lua b/spec/01-unit/04-prefix_handler_spec.lua index 40dca3dd4749..c1e36f8060f0 100644 --- a/spec/01-unit/04-prefix_handler_spec.lua +++ b/spec/01-unit/04-prefix_handler_spec.lua @@ -968,7 +968,7 @@ describe("NGINX conf compiler", function() end) it("injects default configurations if wasm=on", function() assert.matches( - ".+proxy_wasm_lua_resolver off;.+", + ".+proxy_wasm_lua_resolver on;.+", kong_ngx_cfg({ wasm = true, }, debug) ) end) @@ -986,14 +986,6 @@ describe("NGINX conf compiler", function() }, debug) ) end) - it("permits overriding proxy_wasm_lua_resolver to on", function() - assert.matches( - ".+proxy_wasm_lua_resolver on;.+", - kong_ngx_cfg({ wasm = true, - nginx_http_proxy_wasm_lua_resolver = "on", - }, debug) - ) - end) it("injects runtime-specific directives (wasmtime)", function() assert.matches( "wasm {.+wasmtime {.+flag flag1 on;.+flag flag2 1m;.+}.+", diff --git a/spec/02-integration/20-wasm/04-proxy-wasm_spec.lua b/spec/02-integration/20-wasm/04-proxy-wasm_spec.lua index ce637af87f6b..812883436ae5 100644 --- a/spec/02-integration/20-wasm/04-proxy-wasm_spec.lua +++ b/spec/02-integration/20-wasm/04-proxy-wasm_spec.lua @@ -786,7 +786,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function() assert.logfile().has.no.line("[crit]", true, 0) end) - pending("resolves DNS hostnames to send an http dispatch, return its response body", function() + it("resolves DNS hostnames to send an http dispatch, return its response body", function() local client = helpers.proxy_client() finally(function() client:close() end)