Hello!
Im working on a custom plugin that is working as expected when tested with Pongo, however, when I bring the plugin into a test cluster the “preread” function of the plugin does not get called.
To isolate testing as much as possible I reduced my plugin to barebones and verified that the plugin is loaded by placing an assert at the start of the handler.lua, but an assert placed in the preread function is not called.
I am inclined to believe what while the plugin is loaded its not part of the included plugins executed here:
https://github.com/Kong/kong/blob/2.1.3/kong/init.lua#L640. The confusing part of this is that the plugin (and the barebones version) both run correctly in Pongo with preread function executed) so any guidance on how to approach debugging this short of building a custom docker image and peppering in a bunch of log statements in the Kong lua would be appreciated.
I am currently testing with Kong 2.1.3 and Kong Ingress Controller 0.9.1
Below is the barebones schema utilized for testing incase that helps
local typedefs = require "kong.db.schema.typedefs" local plugin_name = ({...})[1]:match("^kong%.plugins%.([^%.]+)") local schema = { name = plugin_name, fields = { { config = { type = "record", fields = { { grants = { type = "array", elements = typedefs.ip_or_cidr, }, }, }, }, }, }, } return schema
edit:
Forgot to include that the plugin is associated with the service that is being used for testing - similar to how the Pongo tests are setup save that we are db-less in Kubernetes.