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

feat(clustering): remove rpc of dynamic log level #13766

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions changelog/unreleased/kong/dynamic-log-level-rpc.yml

This file was deleted.

1 change: 0 additions & 1 deletion kong-3.9.0-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ build = {
["kong.clustering.rpc.utils"] = "kong/clustering/rpc/utils.lua",
["kong.clustering.rpc.concentrator"] = "kong/clustering/rpc/concentrator.lua",

["kong.clustering.services.debug"] = "kong/clustering/services/debug.lua",
["kong.clustering.services.sync"] = "kong/clustering/services/sync/init.lua",
["kong.clustering.services.sync.rpc"] = "kong/clustering/services/sync/rpc.lua",
["kong.clustering.services.sync.hooks"] = "kong/clustering/services/sync/hooks.lua",
Expand Down
70 changes: 0 additions & 70 deletions kong/clustering/services/debug.lua

This file was deleted.

4 changes: 0 additions & 4 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,6 @@ function Kong.init()
kong.sync = require("kong.clustering.services.sync").new(db, is_control_plane(config))
kong.sync:init(kong.rpc)
end

if is_data_plane(config) then
require("kong.clustering.services.debug").init(kong.rpc)
end
end
end

Expand Down
8 changes: 6 additions & 2 deletions spec/02-integration/18-hybrid_rpc/01-rpc_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,19 @@ for _, strategy in helpers.each_strategy() do
local body = assert.res_status(200, res)
local json = cjson.decode(body)

assert(json)

-- TODO: need a new test method
for _, v in pairs(json.data) do
if v.ip == "127.0.0.1" and v.rpc_capabilities and #v.rpc_capabilities ~= 0 then
table.sort(v.rpc_capabilities)
assert.near(14 * 86400, v.ttl, 3)
-- kong.debug.log_level.v1 should be the first rpc service
assert.same("kong.debug.log_level.v1", v.rpc_capabilities[1])
-- TODO: check the available rpc service
return true
end
end

return true
end, 10)
end)
end)
Expand Down
185 changes: 0 additions & 185 deletions spec/02-integration/18-hybrid_rpc/02-log-level_spec.lua

This file was deleted.

35 changes: 5 additions & 30 deletions spec/02-integration/18-hybrid_rpc/04-concentrator_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ local helpers = require "spec.helpers"
local cjson = require("cjson.safe")


local function obtain_dp_node_id()
-- keep it for future usage
local function obtain_dp_node_id() -- luacheck: ignore
local dp_node_id

helpers.wait_until(function()
Expand Down Expand Up @@ -77,35 +78,9 @@ for _, strategy in helpers.each_strategy() do
helpers.stop_kong()
end)

describe("Dynamic log level over RPC", function()
it("can get the current log level", function()
local dp_node_id = obtain_dp_node_id()

-- this sleep is *not* needed for the below wait_until to succeed,
-- but it makes the wait_until tried succeed sooner because this
-- extra time gives the concentrator enough time to report the node is
-- online inside the DB. Without it, the first call to "/log-level"
-- will always timeout after 5 seconds
ngx.sleep(1)

helpers.wait_until(function()
local admin_client = helpers.admin_client()
finally(function()
admin_client:close()
end)

local res = assert(admin_client:get("/clustering/data-planes/" .. dp_node_id .. "/log-level"))
if res.status == 200 then
local body = assert.res_status(200, res)
local json = cjson.decode(body)
assert.equal(0, json.timeout)
assert.equal("debug", json.current_level)
assert.equal("debug", json.original_level)
return true
end
end, 10)
end)
end)
-- TODO: test with other rpc
--describe("XXX over RPC", function()
--end)
end)
end -- for _, strategy
end -- for inc_sync
Loading