Skip to content

Commit

Permalink
rename to cluster_rpc_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Dec 17, 2024
1 parent fad17ba commit b500833
Show file tree
Hide file tree
Showing 25 changed files with 147 additions and 147 deletions.
2 changes: 1 addition & 1 deletion kong/conf_loader/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ local CONF_PARSERS = {
cluster_use_proxy = { typ = "boolean" },
cluster_dp_labels = { typ = "array" },
cluster_rpc = { typ = "boolean" },
cluster_incremental_sync = { typ = "boolean" },
cluster_rpc_sync = { typ = "boolean" },
cluster_full_sync_threshold = { typ = "number" },
cluster_cjson = { typ = "boolean" },

Expand Down
4 changes: 2 additions & 2 deletions kong/conf_loader/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1034,10 +1034,10 @@ local function load(path, custom_conf, opts)
end
end

if conf.cluster_incremental_sync and not conf.cluster_rpc then
if conf.cluster_rpc_sync and not conf.cluster_rpc then
log.warn("Cluster incremental sync has been forcibly disabled, " ..
"please enable cluster RPC.")
conf.cluster_incremental_sync = false
conf.cluster_rpc_sync = false
end

-- parse and validate pluginserver directives
Expand Down
2 changes: 1 addition & 1 deletion kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ function Kong.init()
if config.cluster_rpc then
kong.rpc = require("kong.clustering.rpc.manager").new(config, kong.node.get_id())

if config.cluster_incremental_sync then
if config.cluster_rpc_sync then
kong.sync = require("kong.clustering.services.sync").new(db, is_control_plane(config))
kong.sync:init(kong.rpc)
end
Expand Down
2 changes: 1 addition & 1 deletion kong/pdk/vault.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ local function new(self)

local not_dbless = conf.database ~= "off" -- postgres
local dp_with_inc_sync = conf.role == "data_plane" and
conf.cluster_incremental_sync
conf.cluster_rpc_sync

return not_dbless or dp_with_inc_sync
end
Expand Down
2 changes: 1 addition & 1 deletion kong/templates/kong_defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cluster_max_payload = 16777216
cluster_use_proxy = off
cluster_dp_labels = NONE
cluster_rpc = off
cluster_incremental_sync = off
cluster_rpc_sync = off
cluster_full_sync_threshold = 512
cluster_cjson = off
Expand Down
10 changes: 5 additions & 5 deletions spec/02-integration/07-sdk/03-cluster_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ fixtures_cp.http_mock.my_server_block = [[
]]

for _, v in ipairs({ {"off", "off"}, {"on", "off"}, {"on", "on"}, }) do
local rpc, inc_sync = v[1], v[2]
local rpc, rpc_sync = v[1], v[2]

for _, strategy in helpers.each_strategy() do
describe("PDK: kong.cluster for #" .. strategy .. " inc_sync=" .. inc_sync, function()
describe("PDK: kong.cluster for #" .. strategy .. " rpc_sync=" .. rpc_sync, function()
local proxy_client

lazy_setup(function()
Expand All @@ -65,7 +65,7 @@ for _, strategy in helpers.each_strategy() do
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}, nil, nil, fixtures_cp))

assert(helpers.start_kong({
Expand All @@ -78,7 +78,7 @@ for _, strategy in helpers.each_strategy() do
proxy_listen = "0.0.0.0:9002",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}, nil, nil, fixtures_dp))
end)

Expand Down Expand Up @@ -116,4 +116,4 @@ for _, strategy in helpers.each_strategy() do
end)
end)
end -- for _, strategy
end -- for inc_sync
end -- for rpc_sync
38 changes: 19 additions & 19 deletions spec/02-integration/09-hybrid_mode/01-sync_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ local KEY_AUTH_PLUGIN


for _, v in ipairs({ {"off", "off"}, {"on", "off"}, {"on", "on"}, }) do
local rpc, inc_sync = v[1], v[2]
local rpc, rpc_sync = v[1], v[2]

for _, strategy in helpers.each_strategy() do

describe("CP/DP communication #" .. strategy .. " inc_sync=" .. inc_sync, function()
describe("CP/DP communication #" .. strategy .. " rpc_sync=" .. rpc_sync, function()

lazy_setup(function()
helpers.get_db_utils(strategy) -- runs migrations
Expand All @@ -31,7 +31,7 @@ describe("CP/DP communication #" .. strategy .. " inc_sync=" .. inc_sync, functi
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -44,7 +44,7 @@ describe("CP/DP communication #" .. strategy .. " inc_sync=" .. inc_sync, functi
proxy_listen = "0.0.0.0:9002",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
worker_state_update_frequency = 1,
}))

Expand Down Expand Up @@ -348,7 +348,7 @@ describe("CP/DP communication #" .. strategy .. " inc_sync=" .. inc_sync, functi
end)
end)

describe("CP/DP #version check #" .. strategy .. " inc_sync=" .. inc_sync, function()
describe("CP/DP #version check #" .. strategy .. " rpc_sync=" .. rpc_sync, function()
-- for these tests, we do not need a real DP, but rather use the fake DP
-- client so we can mock various values (e.g. node_version)
describe("relaxed compatibility check:", function()
Expand All @@ -368,7 +368,7 @@ describe("CP/DP #version check #" .. strategy .. " inc_sync=" .. inc_sync, funct
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_version_check = "major_minor",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))

for _, plugin in ipairs(helpers.get_plugins_list()) do
Expand Down Expand Up @@ -625,7 +625,7 @@ describe("CP/DP #version check #" .. strategy .. " inc_sync=" .. inc_sync, funct
end)
end)

describe("CP/DP config sync #" .. strategy .. " inc_sync=" .. inc_sync, function()
describe("CP/DP config sync #" .. strategy .. " rpc_sync=" .. rpc_sync, function()
lazy_setup(function()
helpers.get_db_utils(strategy) -- runs migrations

Expand All @@ -637,7 +637,7 @@ describe("CP/DP config sync #" .. strategy .. " inc_sync=" .. inc_sync, function
db_update_frequency = 3,
cluster_listen = "127.0.0.1:9005",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -648,7 +648,7 @@ describe("CP/DP config sync #" .. strategy .. " inc_sync=" .. inc_sync, function
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_control_plane = "127.0.0.1:9005",
proxy_listen = "0.0.0.0:9002",
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
cluster_rpc = rpc,
worker_state_update_frequency = 1,
}))
Expand Down Expand Up @@ -754,7 +754,7 @@ describe("CP/DP labels #" .. strategy, function()
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -768,7 +768,7 @@ describe("CP/DP labels #" .. strategy, function()
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_dp_labels="deployment:mycloud,region:us-east-1",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))
end)

Expand Down Expand Up @@ -797,7 +797,7 @@ describe("CP/DP labels #" .. strategy, function()
assert.equal(CLUSTERING_SYNC_STATUS.NORMAL, v.sync_status)
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
if inc_sync == "off" then
if rpc_sync == "off" then
assert.equal("mycloud", v.labels.deployment)
assert.equal("us-east-1", v.labels.region)
end
Expand All @@ -822,7 +822,7 @@ describe("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -836,7 +836,7 @@ describe("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_dp_labels="deployment:mycloud,region:us-east-1",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))
end)

Expand All @@ -861,7 +861,7 @@ describe("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
if v.ip == "127.0.0.1" then
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
if inc_sync == "off" then
if rpc_sync == "off" then
assert.equal(1888983905, v.cert_details.expiry_timestamp)
end
return true
Expand All @@ -888,7 +888,7 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
cluster_mtls = "pki",
cluster_ca_cert = "spec/fixtures/kong_clustering_ca.crt",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))

assert(helpers.start_kong({
Expand All @@ -905,7 +905,7 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
cluster_server_name = "kong_clustering",
cluster_ca_cert = "spec/fixtures/kong_clustering.crt",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))
end)

Expand All @@ -930,7 +930,7 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
if v.ip == "127.0.0.1" then
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
if inc_sync == "off" then
if rpc_sync == "off" then
assert.equal(1897136778, v.cert_details.expiry_timestamp)
end
return true
Expand All @@ -942,4 +942,4 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
end)

end -- for _, strategy
end -- for inc_sync
end -- for rpc_sync
32 changes: 16 additions & 16 deletions spec/02-integration/09-hybrid_mode/02-start_stop_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ local helpers = require "spec.helpers"


for _, v in ipairs({ {"off", "off"}, {"on", "off"}, {"on", "on"}, }) do
local rpc, inc_sync = v[1], v[2]
local rpc, rpc_sync = v[1], v[2]

describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
describe("invalid config are rejected" .. " rpc_sync=" .. rpc_sync, function()
describe("role is control_plane", function()
it("can not disable admin_listen", function()
local ok, err = helpers.start_kong({
Expand All @@ -15,7 +15,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
admin_listen = "off",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -31,7 +31,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_listen = "off",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -47,7 +47,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
database = "off",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -63,7 +63,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_mtls = "pki",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -81,7 +81,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
proxy_listen = "off",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -96,7 +96,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -114,7 +114,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_dp_labels = "w@:_a",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -132,7 +132,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
proxy_listen = "0.0.0.0:" .. helpers.get_available_port(),
cluster_dp_labels = "Aa-._zZ_key:Aa-._zZ_val",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})
assert.True(ok)
helpers.stop_kong("servroot2")
Expand All @@ -148,7 +148,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
database = param[2],
prefix = "servroot2",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -163,7 +163,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
prefix = "servroot2",
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
})

assert.False(ok)
Expand All @@ -174,7 +174,7 @@ describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
end)

-- note that lagacy modes still error when CP exits
describe("when CP exits before DP" .. " inc_sync=" .. inc_sync, function()
describe("when CP exits before DP" .. " rpc_sync=" .. rpc_sync, function()
local need_exit = true

lazy_setup(function()
Expand All @@ -188,7 +188,7 @@ describe("when CP exits before DP" .. " inc_sync=" .. inc_sync, function()
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_listen = "127.0.0.1:9005",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
}))
assert(helpers.start_kong({
role = "data_plane",
Expand All @@ -199,7 +199,7 @@ describe("when CP exits before DP" .. " inc_sync=" .. inc_sync, function()
proxy_listen = "0.0.0.0:9002",
database = "off",
cluster_rpc = rpc,
cluster_incremental_sync = inc_sync,
cluster_rpc_sync = rpc_sync,
-- EE [[
-- vitals uses the clustering strategy by default, and it logs the exact
-- same "error while receiving frame from peer" error strings that this
Expand All @@ -223,4 +223,4 @@ describe("when CP exits before DP" .. " inc_sync=" .. inc_sync, function()
assert.logfile("servroot2/logs/error.log").has.no.line("error while receiving frame from peer", true)
end)
end)
end -- for inc_sync
end -- for rpc_sync
Loading

0 comments on commit b500833

Please sign in to comment.