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

fix(incremental): initial default workspace for importing declarative config #13740

Merged
Merged
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
7 changes: 5 additions & 2 deletions kong/db/dao/workspaces.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ local constants = require("kong.constants")
local lmdb = require("resty.lmdb")


local DECLARATIVE_DEFAULT_WORKSPACE_ID = constants.DECLARATIVE_DEFAULT_WORKSPACE_ID
local DECLARATIVE_DEFAULT_WORKSPACE_KEY = constants.DECLARATIVE_DEFAULT_WORKSPACE_KEY


Expand All @@ -28,8 +27,12 @@ end

function Workspaces:select_by_name(key, options)
if kong.configuration.database == "off" and key == "default" then
-- We can ensure that when starting in dbless mode, lmdb will by default
-- insert a 'default' workspace. If this Kong is a dataplane, it will later
-- synchronize the configuration from the CP and overwrite this default one.
--
-- it should be a table, not a single string
return { id = lmdb.get(DECLARATIVE_DEFAULT_WORKSPACE_KEY) or DECLARATIVE_DEFAULT_WORKSPACE_ID, }
return { id = lmdb.get(DECLARATIVE_DEFAULT_WORKSPACE_KEY), }
end

return self.super.select_by_name(self, key, options)
Expand Down
Loading