Problem Statement
Currently, decK supports custom plugin deployment through the custom_plugins section in the declarative configuration file.
Example:
_format_version: "3.0"
_transform: true
custom_plugins:
- name: my-example-plugin
schema: |
return {
name = "my-example-plugin",
fields = {
{
config = {
type = "record",
fields = {
{ example_field = { type = "string", required = true } },
{ another_example_field = { type = "string", required = true } },
},
},
},
},
}
handler: |
local MyPluginHandler = {
PRIORITY = 1000,
VERSION = "0.0.1",
}
function MyPluginHandler:access(config)
-- plugin logic here
end
return MyPluginHandler
Deployment:
deck gateway apply --include-plugin-definitions kong.yaml
or
deck gateway sync --include-plugin-definitions kong.yaml
While this works well for distributing plugin definitions, it creates challenges during plugin development, testing, and debugging.
Current Challenges
The plugin source code is typically developed and maintained as standalone Lua files:
plugins/
├── my-example-plugin/
│ ├── handler.lua
│ └── schema.lua
A common workflow is:
- Develop and test handler.lua and schema.lua.
- Copy the contents into the decK YAML file.
- Run deck gateway apply.
- Make changes during debugging.
- Copy the updated code back into the YAML file.
- Re-apply with decK.
This results in:
- Duplication of source code.
- Additional manual steps during development.
- Risk of YAML and Lua files becoming out of sync.
- Reduced IDE support when the source of truth becomes embedded YAML content.
- Larger and harder-to-maintain declarative configuration files.
Proposed Enhancement
Allow custom_plugins to reference external files for the schema and handler definitions.
Example:
custom_plugins:
- name: my-example-plugin
schema_file: ./plugins/my-example-plugin/schema.lua
handler_file: ./plugins/my-example-plugin/handler.lua
During deck gateway apply --include-plugin-definitions, decK would:
- Read the referenced files.
- Load their contents internally.
- Upload the plugin definitions exactly as it does today.
The resulting payload sent to Kong would remain unchanged.
Benefits
- Improved developer experience.
- Faster plugin development and debugging iterations.
- Eliminates duplication between Lua source files and YAML definitions.
- Better integration with IDE features such as syntax highlighting, formatting, linting, and testing.
- Easier version control and code reviews.
- Keeps declarative configuration files concise and readable.
- Aligns with common Infrastructure-as-Code practices where large artifacts are stored in dedicated files and referenced from configuration.
Use Case
Teams developing custom Kong plugins often maintain plugin source code in a repository and use decK to publish plugin definitions to Konnect or Kong Gateway.
Supporting external file references would enable a workflow where the Lua files remain the single source of truth, allowing developers to:
# Edit Lua files
vim handler.lua
# Apply changes directly
deck gateway apply --include-plugin-definitions kong.yaml
without requiring a manual copy-and-paste step into the YAML file.
Expected Outcome
decK should support reading plugin schema and handler code from external Lua files and automatically embedding their contents during the apply/sync operation, while maintaining full backward compatibility with the current inline YAML approach.
Problem Statement
Currently, decK supports custom plugin deployment through the custom_plugins section in the declarative configuration file.
Example:
Deployment:
or
While this works well for distributing plugin definitions, it creates challenges during plugin development, testing, and debugging.
Current Challenges
The plugin source code is typically developed and maintained as standalone Lua files:
A common workflow is:
This results in:
Proposed Enhancement
Allow custom_plugins to reference external files for the schema and handler definitions.
Example:
During deck gateway apply --include-plugin-definitions, decK would:
The resulting payload sent to Kong would remain unchanged.
Benefits
Use Case
Teams developing custom Kong plugins often maintain plugin source code in a repository and use decK to publish plugin definitions to Konnect or Kong Gateway.
Supporting external file references would enable a workflow where the Lua files remain the single source of truth, allowing developers to:
without requiring a manual copy-and-paste step into the YAML file.
Expected Outcome
decK should support reading plugin schema and handler code from external Lua files and automatically embedding their contents during the apply/sync operation, while maintaining full backward compatibility with the current inline YAML approach.