Feature Request: Support External Lua Files for custom_plugins Definitions
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Inizia tracciando il modo in cui deck gateway apply e sync caricano custom_plugins quando è impostato --include-plugin-definitions. Usa come riferimento la gestione inline esistente di schema e handler, quindi verifica che schema_file e handler_file possano caricare schema.lua e handler.lua, preservando il comportamento inline attuale e il payload Kong risultante.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 507
- Fork
- 142
- Merge medio
- 1g 15h
- PR unite (30g)
- 9
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Kong/deck
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Cojekt/LibreDental#258 ·
I maintainer di solito rispondono entro 1 giorno
-
go good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
opensro-dev/opensro#4949 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 3 giorni
-
agent-execution/02 row 4: consumers Verify row lacks delivery/base binding, cannot pass post-mergeApertabug effort:s impact:low raised-by:verifier risk:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
medici-finance/assay#7946 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno