-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tt-1924] Go plugins per method and path #3489
Conversation
6359edc
to
fc8e7bb
Compare
fc8e7bb
to
8f46633
Compare
…com/TykTechnologies/tyk into feature/goplugin-perpath-middleware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! amazing job
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
/release to release-3 |
Working on it! Note that it can take a few minutes. |
* load go plugins per method and path in apispec * method check against middleware path * rename struct tag * tests and handler grabber from url specs * load go plugins per method and path in apispec * rename struct tag * clean up merge conflicts * more cleanup and remove print log * removed unused function * remove unneccesary print * remove debugging * go plugin on api and per path level plus tests * goimports gw (cherry picked from commit bf5ddd0)
@tbuchaillot Succesfully merged |
Description
Allows a Tyk user to run a different Go function in every single possible part of their API if they should want to. Can be a high performance replacement for the JSVM virtual endpoints.
Think of it as having either as many native Go lambda style functions inside the Gateway available to you as you want, or if you want, unlike existing JS virtual endpoints, requests pass through to real upstreams and you just get the extra flexibility of this setup.
Related Issue
Internal ticket viewable here https://tyktech.atlassian.net/browse/TT-1924
Motivation and Context
Our virtual endpoints are really well loved by users but have some issues with high performance scenarios. Go plugins are the most native way to inject extra code into the API Gateway. Previous there were set hooks that a plugin function could sit and every request would route through it.
This PR makes it so that the Go plugins can be loaded per path and method using the usual API designer definitions.
Users can utilise this in a few different ways:
Both cases are handled and users can mix and match depending on their complexity and code ownership.
How This Has Been Tested
See the /test/goplugin folder for function examples.
In your API definition set up your per path/method goplugin functions as an array of config blocks just like any other API designer middleware.
Functions can all be in a single file or be pulled in from various files.
The same rules apply as with the existing go plugins and we recommend using the Go Plugin compiler container to help you create the shared objects that are guaranteed to work with a particular gateway version.
Types of changes
Checklist
fork, don't request your
master
!master
branch (left side). Also, you should startyour branch off our latest
master
.go mod tidy && go mod vendor
go fmt -s
go vet