Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe what this PR does / why we need it
There are many scenarios in the control plane that require expansion, such as the parsing, conversion or application of some custom CRDs. The Go language itself does not have good support for the extension mechanism. After evaluating the plug-in solution's research results and project ideas, a multi-process solution based on communication was finally adopted, implemented using the go-plugin framework, and the outer layer was packaged to form a The set of infrastructure is highly reusable and can adapt to different plug-ins. Learn from other open source products that have used go-plugin, and create a plug-in mechanism that supports the extensibility of the control plane according to the needs of the control plane.
This PR implements the control plane extensibility mechanism and builds a plug-in system.
Does this pull request fix one issue?
Fixes #46
Describe how you did it
Adopting the gRPC idea, a new plug-in process is started locally to provide corresponding method calling services for the main program. The plug-in process can provide scalable functions at different points in the main link configured by the control plane.
The request plug-in flow chart is as follows:

Describe how to verify it
To build the plug-in executable program, execute the
make
command in the plug-in directory and the corresponding file will be generated underplugin/assets
.Currently, you can directly start the control plane to start the plug-in service, or you can ``go build main.go
under
main/``` to test an already written Demo plug-in: Stream. This is a plugin that can be called in both directions. So how to write a simple plug-in?For example ```ratelimit``` plugin
pl/builtin
directory and embed them into the go-plugin framework. That’s it.server
directory, because the script executed by make scans this directory.func ServerPlugin
inplugin/pl/plugin/plugin.go
, for example:By the way, there is currently no particularly good way to assert the plugin type here.
Now that the basic plug-in building work is completed, you can expose the plug-in to the control plane according to the plug-in name and call it at the appropriate location.
Special notes for reviews