-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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(pdk) introduce the Plugin Development Kit #3556
Conversation
64f97cf
to
1b0a9c8
Compare
Green builds on internal build environment 👍 Bypassing Travis-ci.org |
* Introduce the `kong.pdk` module, a skeleton/loader for the PDK * Introduce Test::Nginx utils * Introduce Test::Nginx certificates
This kit is based on the existing `kong/tools/ip.lua` module.
The goal of this module is to expose a private interface to the core, in order to manipulate the `kong` global, which is comprised of the PDK (Plugin Development Kit), and various other legacy singletons (DAO, cache, DNS resolver, etc...)
This fix visibility issues of `kong` global variable.
function _IP.is_trusted() return false end | ||
|
||
elseif trust_all_ipv4 and trust_all_ipv6 then | ||
function _IP.is_trusted() return true end |
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.
this code is hard to read, and not in line with the rest of the codebase (see else
clause below), can we update this to:
_IP.is_trusted = function() return true end
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.
Sure, though changing that single line to another presentation of the same thing is more or less just syntax juggling. This is just copy-pasted from here:
https://github.com/Kong/kong/blob/master/kong/tools/ip.lua
(but I agree for consistency, one syntax should be used)
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.
Sure, though changing that single line to another presentation of the same thing is more or less just syntax juggling.
👍, not worth it imho.
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.
of course it is syntax juggling, since it is style related. The original file didn't have this style issue though. Will send a pr.
The Plugin Development Kit (or "PDK") is a set of functions (SDK) and variables that will ease the task of writing Kong plugins. The first version of the PDK mainly consists of several "stateless" modules to retrieve and manipulate the request and response. A few other minor utilities such as logging or context storing.
The documentation is included in the source, and will be published on the documentation website shortly.
Overview
kong.version
kong.version_num
kong.pdk_major_version
kong.pdk_version
kong.configuration
kong.dao
kong.db
kong.dns
kong.ipc
kong.cache
kong.table
kong.log
kong.ctx
kong.client
kong.request
kong.service
kong.service.request
kong.service.response
kong.response