You can add custom plugins to the Gateway Manager by uploading a Lua schema file to a Control Plane.
Using that schema, Gateway Manager creates a plugin configuration object in Konnect,
making the plugin available for configuration alongside all the Kong bundled plugins.
This means that Konnect only sees a custom plugin’s configuration options, and doesn’t see any other plugin code.
To run in Konnect, a custom plugin must meet the following requirements:
General requirements:
Each custom plugin must have a unique name.
All plugin files must also be deployed to each Kong Gateway Data Plane node.
File structure requirements:
The plugin must not contain an api.lua file, as Admin API extensions are not supported.
The plugin must not contain the dao.lua or migrations.lua files, as custom data entities are not supported.
Code and language requirements:
The schema for your custom plugin must be written in Lua.
Custom validation functions must be written in Lua and be self-contained within the schema.lua file.
The schema.lua file must not contain any require() statements.
Plugins that require third-party libraries must reference them in the handler.lua file.
Caution: Carefully test the operation of any custom plugins before using them in production.
Kong is not responsible for the operation or support of any custom plugins,
including any performance impacts on your Konnect or Kong Gateway deployments.
The workflow for updating an in-use custom plugin depends on whether you need to update the schema:
No change to plugin schema: Editing a custom plugin’s logic without altering its schema won’t
cause the Control Plane to go out of sync with its Data Planes.
In this situation, you only need to make sure that each Data Plane node has the correct logic.
The schema on the Control Plane doesn’t need to be updated.
Changes to plugin schema: If there are changes required in the plugin schema,
you must update both the schema in Konnect and the plugin code itself on each Data Plane node.
In this case, see the custom plugin update paths for possible scenarios and recommended paths.
Deleting a plugin and its schema: If you need to completely remove the plugin from your
Control Plane, you must remove all existing plugin configurations of this entity, then remove
the schema from the Control Plane and all plugin files from the Data Plane nodes.
There is no built-in versioning for custom plugins.
If you need to version a schema (that is, maintain two or more similar copies of a custom plugin),
upload it as a new custom plugin and add a version identifier to the name.
For example, if your original plugin is named delay, you can name the new version delay-v2.
When you need to make plugin changes, we recommend updating the schema in Konnect first, and then on the Data Plane nodes.
This is especially important making a breaking change to the schema,
as the change will affect each Data Plane node as soon as the node receives its first payload.
This will happen even if there are no changes in the Control Plane for existing or new plugins using the updated schema.
See the following table for a comparison of possible changes and upgrade paths, in the case of
a configuration parameter change in a custom plugin’s schema:
Scenario
Change to required default
Change to required non-default
Change to optional default
Change to optional non-default
Configuration parameter added to schema
Short
Long
Short
Short
Configuration parameter removed from schema
Long
CP/DP sync required
Long
Long
Configuration parameter’s datatype changed
CP/DP sync required
CP/DP sync required
CP/DP sync required
CP/DP sync required
Based on your specific use case, you have to take one of the following paths:
Start a migration/maintenance window.
Update the plugin schema in Konnect.
Update the plugin schema on each Data Plane node.
Stop the migration/maintenance window.
Start a migration/maintenance window.
Update the plugin schema in Konnect.
Update the configuration for existing plugin instances.
Update the plugin schema on each Data Plane node.
Stop the migration/maintenance window.
Start a migration/maintenance window.
Update the plugin schema in Konnect.
(Optional) Update the configuration for existing plugin instances.
Based on the nature of the schema updates, you might need this optional step
after updating the schema in Konnect to make sure that any
existing plugin entities are updated before the schemas are
changed in the Data Plane nodes.
Issue: You may see the error unable to update running config: bad config received from Control Plane with required field missing:
[lua] data_plane.lua:244: [clustering] unable to update running config: bad config received from Control Plane in'plugins':
- in entry 1 of 'plugins':
in'config':
in'ttl': required field missing, context: ngx.timer
This means that a required field was removed from the schema on the Control Plane, but the schema on the Data Plane wasn’t updated.
The Control Plane triggered a payload update and attempted to update the Data Plane, but ran into conflicts.
Solution: Make sure the Data Plane has an up-to-date schema.
A non-breaking change to a plugin schema fits the following criteria:
No default values
Parameter isn’t marked as required
Adding a non-breaking schema change won’t disrupt Data Plane payload validation.
This means that even if new plugins are added or existing ones are updated, the Data Plane will
stay in sync because null fields are gracefully handled and ignored.
Here’s an example of a non-breaking change to a schema. This snippet adds a non-required
new_ttl configuration parameter without a default value, and a response
header that references an existing typedef:
When a schema file is updated in Konnect, the Konnect
platform doesn’t trigger payload reconciliation automatically.
This means that if you don’t make any configuration changes in the Control Plane, such as adding,
modifying, or deleting a Kong Gateway entity, the Data Plane nodes won’t receive a
payload update, and won’t use the updated schema.
When pushing changes to the Control Plane, the payload reconciliation only affects
Data Plane nodes if an instance of the plugin that uses the updated schema has its
configuration changed.
Since plugin configurations are stored as JSON blobs, a schema change alone doesn’t impact the
plugin configuration. However, if an instance of this plugin is also updated, the new schema affects how
any new plugin configuration is represented.
In summary:
Uploading a custom plugin schema adds a new configurable object to the Konnect Plugin Hub,
both as a tile in the UI, and an API endpoint.
Modifying the schema itself does not trigger payload updates to Data Plane nodes.
The new tile or endpoint added by the schema lets you create plugin configurations.
If you create a plugin configuration in this way, it triggers a payload reconciliation with the Data Plane nodes.