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

Add data-source extension for OpenSergo fault-tolerance spec #2842

Merged
merged 4 commits into from
Nov 8, 2022

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Aug 23, 2022

Signed-off-by: Eric Zhao sczyh16@gmail.com

Describe what this PR does / why we need it

Add data-source extension for OpenSergo fault-tolerance specification, so that users could leverage unified OpenSergo CRDs to manage Sentinel rules.

Does this pull request fix one issue?

Resolves #2841

Describe how you did it

Basic design:

image

  • OpenSergoRuleAggregator: gather all OpenSergo fault-tolerance rules and convert them to Sentinel rules

Current supported strategies:

  • RateLimitStrategy (FlowRule, controlBehavior=0)
  • ThrottlingStrategy (FlowRule, controlBehavior=2)
  • ConcurrencyLimitStrategy (FlowRule, limitMode=concurrency)
  • CircuitBreakerStrategy (DegradeRule)
  • AdaptiveOverloadProtectionStrategy (SystemRule)

Describe how to verify it

A demo for creating and registering OpenSergo data-source:

OpenSergoDataSourceGroup openSergo = new OpenSergoDataSourceGroup(host, port, namespace, appName);
openSergo.start();

// Subscribe flow rules from OpenSergo control plane, and propagate to Sentinel rule manager.
FlowRuleManager.register2Property(openSergo.subscribeFlowRules());

Unit test TBD...

Special notes for reviews

This PR uses a beta version of opensergo-java-sdk. See https://github.com/opensergo/opensergo-java-sdk for details.

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@sczyh30 sczyh30 added kind/feature Category issues or prs related to feature request. area/data-source Issues or PRs related to data-source extension labels Aug 23, 2022
}

public void start() throws Exception {
if (started.compareAndSet(false, true)) {
Copy link
Contributor

@kaori-seasons kaori-seasons Aug 23, 2022

Choose a reason for hiding this comment

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

Is it possible to set a delayed start here, such as the following code segment:

ScheduledExecutorService singlonThread = Executors
.newSingleThreadScheduledExecutor();
while (!singlonThread.awaitTermination(3000,
TimeUnit.MILLISECONDS)) {
singleThread.shutdown();
}

This is done so that the user can manually set the timeout

Copy link
Contributor

@jnan806 jnan806 left a comment

Choose a reason for hiding this comment

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

.

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@sczyh30 sczyh30 force-pushed the feature/opensergo-datasource branch from 80639d1 to e551cbf Compare October 25, 2022 11:46
@sczyh30 sczyh30 changed the title [WIP] Add data-source extension for OpenSergo spec Add data-source extension for OpenSergo fault-tolerance spec Oct 25, 2022
@sczyh30 sczyh30 marked this pull request as ready for review October 25, 2022 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/data-source Issues or PRs related to data-source extension kind/feature Category issues or prs related to feature request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add data-source extension for OpenSergo rate limiting and fault-tolerance spec
4 participants