Related Documentation
OpenAPI Specifications
Minimum Version
Kong Gateway - 3.10
Tags
Related Resources

What is a Partial?

Partials allow you to reuse shared configuration across plugins.

Some plugins in Kong Gateway share common configuration settings that often need to be repeated. Partials allow you to extract those shared configurations into reusable entities that can be linked to multiple plugins. Without Partials, you would need to replicate this configuration across all plugins. If the settings change, you would need to update each plugin individually.

To ensure validation and consistency, Partials have defined types. Kong Gateway supports the following Partial types:

  • redis-ce: A short and simple Redis configuration.
  • redis-ee: A Redis configuration with support for Redis Sentinel or Redis Cluster connections.
  • vectordb v3.13+: Vector database connection and search settings, shared across AI plugins that perform semantic search.
  • embeddings v3.13+: Embeddings model provider and authentication, shared across AI plugins that generate vector embeddings.
  • model v3.13+: LLM provider, model name, authentication, and inference settings, shared across AI plugins that call language models.

Each plugin supports only the Partial types listed in its documentation.

In Konnect, Partials are only supported for bundled Konnect plugins. Custom plugins don’t support Partials.

Redis Partials

Define a Redis Partial once and reference it across plugins to avoid repeating connection details, reduce configuration errors, and ensure consistent Redis behavior. The following plugins use Redis for storing counters, sessions, or cached data:

Plugin Name

Redis Usage (What’s Stored)

Partial type

Benefit of using a Partial

ACME Certificate state (Let’s Encrypt ACME data) redis-ce Keep certificate state storage consistent across environments by reusing one Redis config.
GraphQL Proxy Caching Advanced Cached GraphQL responses redis-ee Apply the same Redis configuration to multiple GraphQL caches for easier management.
GraphQL Rate Limiting Advanced GraphQL request counters redis-ee Standardise Redis-based GraphQL rate limiting across endpoints with one Partial.
OpenID Connect Sessions and tokens redis-ee Reuse Redis settings for session storage, avoiding redundant configs across identity flows.
Proxy Caching Advanced Cached API responses redis-ee Reuse a single Redis definition to simplify and stabilise cache behaviour.
Rate Limiting Request counters redis-ce Apply the same Redis setup across multiple rate limiting policies without duplication.
Rate Limiting Advanced Request counters (supports Sentinel/Cluster) redis-ee Centralize complex Redis HA configuration so all services use it reliably.
Response Rate Limiting Response counters redis-ce Ensure consistent Redis-backed throttling rules across different services.
SAML Session data redis-ee Centralize session handling so all SAML flows share the same Redis configuration.

Set up a Redis Partial

The following examples describe how to use Partials with plugins.

Add a Partial to a plugin

To use a Partial in a plugin, configure the partials.id parameter:

Remove a Partial from a plugin

To remove a Partial, remove the partials parameter. Make sure to configure the corresponding elements directly in your plugin configuration:

Check Partial usage

To see which plugins use a specific Partial:

  1. Use GET /partials/ to get the list of Partials, and get the ID of the Partial to check.
  2. Use GET /partials/$PARTIAL_ID to get a list of plugins that use this Partial.

AI plugin Partials v3.13+

AI Gateway plugins often share the same vector database, embeddings model, or LLM configuration across multiple plugins. For example, you might run both the AI Semantic Cache plugin and the AI RAG Injector plugin against the same pgvector database using the same OpenAI embeddings model. Without Partials, you would need to define this configuration in each plugin individually.

With AI Partials, define the shared configuration once and link it to any number of plugins.

The AI Proxy Advanced plugin supports all three AI Partial types. A model Partial applies to each entry in the config.targets array, so you can share one provider configuration across multiple targets.

Set up AI Partials

The following examples use OpenAI as the embeddings and model provider, and pgvector as the vector database. You’ll need an OpenAI API key and a running pgvector instance.

VectorDB Partial (pgvector)

Create a Partial with type: vectordb:

Embeddings Partial (OpenAI)

Create a Partial with type: embeddings:

Model Partial (OpenAI GPT-4o)

Create a Partial with type: model:

Once created, link AI Partials to plugins the same way as Redis Partials: pass the Partial ID in the partials array. See Add a Partial to a plugin.

You cannot provide inline configuration for the same fields that a linked Partial covers. Either define the settings directly in the plugin, or leave that block empty and use a Partial instead.

Enable Partials support in custom plugins

Use the Partials feature in your custom plugins by adjusting the plugin schema. To make custom plugins compatible with Partials, add the supported_partials key to the schema and specify the appropriate Partial type.

Here is an example schema for a custom plugin using a Partial:

{
  name = "custom-plugin-with-redis",
  supported_partials = {
    ["redis-ee"] = { "config.redis" },
  },
  fields = {
    {
      config = {
        type = "record",
        fields = {
          { some_other_config_key = { type = "string", required = true }},
          { redis = redis.config_schema }
        },
      },
    },
  },
}

Using DAO in custom plugins

Be aware that when using a Partial, the configuration belonging to the Partial is no longer stored alongside the plugin. If your code relies on Kong Gateway’s DAO and expects entities to contain Redis information, this data won’t be retrieved when using kong.db.plugins:select(plugin_id). Such a call will only fetch data stored in the plugin itself.

To include the Partial’s data within the plugin configuration, you must pass a special option parameter, such as: kong.db.plugins:select(plugin_id, { expand_partials = true }).

Schema

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!