Skip to content

Commit

Permalink
fix(sync): full sync not working if dedicated disabled (#13857)
Browse files Browse the repository at this point in the history
Clustering initialization needs to be handled when the dedicated worker is off

https://konghq.atlassian.net/browse/KAG-5807
(cherry picked from commit f494c53)
  • Loading branch information
StarlightIbuki authored and bungle committed Nov 18, 2024
1 parent 6e7ce61 commit fc1ed7d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -998,19 +998,23 @@ function Kong.init_worker()
-- ]]

if kong.clustering then
-- full sync dp

local is_dp_full_sync_agent = process.type() == "privileged agent" and not kong.sync

if is_control_plane(kong.configuration) or -- CP needs to support both full and incremental sync
is_dp_full_sync_agent -- full sync is only enabled for DP if incremental sync is disabled
then
if is_control_plane(kong.configuration) then-- CP needs to support both full and incremental sync
kong.clustering:init_worker()
end

-- full sync is only enabled for DP if incremental sync is disabled
elseif is_data_plane(kong.configuration) and not kong.sync then
local using_dedicated = kong.configuration.dedicated_config_processing
if using_dedicated and process.type() == "privileged agent" then
-- full sync dp agent
kong.clustering:init_worker()
return

-- DP full sync agent skips the rest of the init_worker
if is_dp_full_sync_agent then
return
end

if not using_dedicated then
-- full sync dp
kong.clustering:init_worker()
end
end
end

Expand Down

0 comments on commit fc1ed7d

Please sign in to comment.