Skip to content
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

Refactor and improve Sentinel Zuul Adapter #698

Merged
merged 2 commits into from
Apr 24, 2019
Merged

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Apr 23, 2019

Describe what this PR does / why we need it

Refactor and improve Sentinel Zuul Adapter based on sentinel-api-gateway-adapter-common, so that it can support (normal and parameter) flow control of both route level and customized API level.

Does this pull request fix one issue?

NONE

Describe how you did it

The refactored SentinelZuulPreFilter will regard all route ID (proxy in RequestContext) and all customized API (retrieved from sentinel-api-gateway-adapter-common module) as resources. The pre-filter may create multiple resource entries, so to pass to the SentinelZuulPostFilter, we'll collect all created entries and put into a stack (based on ArrayDeque), then carry it into the RequestContext. Then when the request is completed, SentinelZuulPostFilter can get the entries from Zuul context and exit them in descending order.

A demo is added to show how to use the adapter.

Describe how to verify it

Run the test cases and demo.

Special notes for reviews

This PR contains breaking changes. Please take care of the changes.

- Now the adapter is based-on sentinel-api-gateway-adapter-common and supports both proxyId and customized APIs

Signed-off-by: Eric Zhao <[email protected]>
@sczyh30 sczyh30 added to-review To review kind/feature Category issues or prs related to feature request. size/XXL Indicate a PR that changes 1000+ lines. labels Apr 23, 2019
@sczyh30
Copy link
Member Author

sczyh30 commented Apr 23, 2019

@tigerMoon Hi, I've refactored the Zuul adapter to support more scenarios for gateway flow control. Would you like to give some suggestions? You can refer to the document here.

@sczyh30 sczyh30 marked this pull request as ready for review April 23, 2019 13:23
Copy link
Contributor

@CarpenterLee CarpenterLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 merged commit 7546bcc into master Apr 24, 2019
@sczyh30 sczyh30 removed the to-review To review label Apr 24, 2019
@sczyh30 sczyh30 added this to the 1.6.0 milestone Apr 24, 2019
@sczyh30 sczyh30 deleted the refactor/zuul-adapter branch April 24, 2019 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Category issues or prs related to feature request. size/XXL Indicate a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants