Overview
Plugins can be used to alter the behaviour of a Backup or a Restore. They allow the user to transform the data between the source and the sink, or to skip certain data. It is possible to configure multiple plugins on a Backup or a Restore in a specific order.
The following plugins are available:
Configuring a plugin on a Backup
Plugins can be configured on a Backup with the .spec.plugins
field.
The ‘spec’ field contains the plugin’s configuration and its content will vary from plugin to plugin.
Configuring a plugin on a Restore
Plugins can be configured on a Restore with the .spec.config.plugins
field:
The ‘spec’ field contains the plugin’s configuration and its content will vary from plugin to plugin.
Disabling pre-flight checks
A restore job will inspect the target topic to make sure it has enough partitions for the restore to succeed.
However some plugins such as the topic-repartitioning
plugin will change the partitioning of the restored records.
For such cases, the disablePreflightChecks
flag can be used to bypass this kind of verifications performed before the restore can start.
Example:
Enabling plugins for a subset of topics
By default, plugins will be enabled for all topics listed in a Backup or a Restore.
You can restrict which topic should be affected by a plugin using the topicSelectors
attribute when configuring a plugin:
In the example above,
the some-plugin
plugin will only be enabled for topics that match one of the selectors:
products.uk.v2
, orders.uk.v2
and invoices.uk.v2
in this case;
the some-plugin
plugin won’t be enabled for customers.uk.v2
.
The literal
selector rule performs an exact match on a topic name.
glob
and regex
rules will match a topic’s name against a pattern.
The accepted syntax for regular expressions is documented here , and the one for glob patterns can be found here .
You can also use selectors to use different instances of the same plugin with different configurations.
However, a particular plugin can only be used once for a given topic.
This means that, if multiple instances of a plugin match a single topic,
only one will be used (typically, the last one defined in spec.config.plugins
).
Plugin Specification
Each plugin instance can be configured using the spec
field.
This field takes an object that is specific to the plugin.
It can contain key-value pairs, nested objects and arrays, and so on.
Writing custom plugins
You can write your own plugins. See the was-plugin section of this guide.