-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(admin-gui): Admin GUI CE/EE unification (#11355)
Some changes to the admin GUI implementation in the CE gateway, makes the CE -> EE merge more easily. Most of the changes are re-position the code blocks, coupling them with the EE code and making git 3-way merger happy, some tests were also refactored This fix KAG-2245 The coupled PR in the EE repo Kong/kong-ee#6199 has been merged
- Loading branch information
Showing
13 changed files
with
152 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
local _M = {} | ||
|
||
-- return first listener matching filters | ||
function _M.select_listener(listeners, filters) | ||
for _, listener in ipairs(listeners) do | ||
local match = true | ||
for filter, value in pairs(filters) do | ||
if listener[filter] ~= value then | ||
match = false | ||
end | ||
end | ||
if match then | ||
return listener | ||
end | ||
end | ||
end | ||
|
||
function _M.prepare_variable(variable) | ||
if variable == nil then | ||
return "" | ||
end | ||
|
||
return tostring(variable) | ||
end | ||
|
||
return _M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
local conf_loader = require "kong.conf_loader" | ||
local prefix_handler = require "kong.cmd.utils.prefix_handler" | ||
|
||
local helpers = require "spec.helpers" | ||
|
||
describe("admin_gui", function() | ||
local conf = assert(conf_loader(helpers.test_conf_path)) | ||
|
||
it("auto-generates SSL certificate and key", function() | ||
assert(prefix_handler.gen_default_ssl_cert(conf, "admin_gui")) | ||
assert(helpers.path.exists(conf.admin_gui_ssl_cert_default)) | ||
assert(helpers.path.exists(conf.admin_gui_ssl_cert_key_default)) | ||
end) | ||
|
||
it("does not re-generate if they already exist", function() | ||
assert(prefix_handler.gen_default_ssl_cert(conf, "admin_gui")) | ||
local cer = helpers.file.read(conf.admin_gui_ssl_cert_default) | ||
local key = helpers.file.read(conf.admin_gui_ssl_cert_key_default) | ||
assert(prefix_handler.gen_default_ssl_cert(conf, "admin_gui")) | ||
assert.equal(cer, helpers.file.read(conf.admin_gui_ssl_cert_default)) | ||
assert.equal(key, helpers.file.read(conf.admin_gui_ssl_cert_key_default)) | ||
end) | ||
|
||
it("generates a different SSL certificate and key from the RESTful API", function() | ||
assert(prefix_handler.gen_default_ssl_cert(conf, "admin_gui")) | ||
local cer, key = {}, {} | ||
cer[1] = helpers.file.read(conf.admin_gui_ssl_cert_default) | ||
key[1] = helpers.file.read(conf.admin_gui_ssl_cert_key_default) | ||
assert(prefix_handler.gen_default_ssl_cert(conf, "admin")) | ||
cer[2] = helpers.file.read(conf.admin_ssl_cert_default) | ||
key[2] = helpers.file.read(conf.admin_ssl_cert_key_default) | ||
assert.not_equals(cer[1], cer[2]) | ||
assert.not_equals(key[1], key[2]) | ||
end) | ||
end) |
Oops, something went wrong.
e7efc1f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:e7efc1fcfb583007597548b475c353d2b00f17df
Artifacts available https://github.com/Kong/kong/actions/runs/6010176474