Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Aug 23, 2022

Signed-off-by: Eric Zhao [email protected]

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.

@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.

.

@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