Skip to content

Conversation

mostafa
Copy link
Member

@mostafa mostafa commented Dec 12, 2022

This PR introduces the plugin system. The plugin system is based on the Hashicorp's go-plugin and tries to run plugins from a locally-accessible directory to GatewayD binary.

It has various parts:

  1. Hooks: callbacks for connecting plugins to GatewayD.
  2. Plugin Protocol: protobuf files, interfaces and stubs to help developers write plugins.
  3. Registry: plugin manager inside GatewayD.

I also developed a minimal test plugin, gateway-plugin-test, to show how one can write a plugin for GatewayD. I'll try to optimize the plugin system as the project moves forward.

…in system

Rename Prio to Priority
Change HookDef to reflect the signature of the gRPC functions
Use structpb.Struct to encapsulate messages as/like JSON
Move Verify method to the utils.go file
Change Run function signature to include a context.Context and grpc.CallOptions
Return error from the Run function
Add SHA256 checksum verification function for plugin files
…used by plugins

Update protobuf file to reflect the changes in the plugin system and hooks
Generate the latest version of protobuf stubs for Go and go-gRPC
…ation

Rename configFile to globalConfigFile
Add pluginConfigFile and pluginConfig koanf object
Add an instance of the plugin registry
Add a default logger
Add loading of all plugins before anything happens
Use the OnConfigLoaded hook to call plugins and update the config in-memory
Update hooks.Run function to use the parameter signatures needed
Add an example gatewayd_plugin.yaml file for testing
@mostafa mostafa removed a link to an issue Dec 12, 2022
7 tasks
@mostafa mostafa merged commit 0854149 into main Dec 12, 2022
@mostafa mostafa deleted the plugin-system branch December 12, 2022 17:33
mostafa added a commit that referenced this pull request Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create the plugin system and expose hooks to the plugins
1 participant