-
Notifications
You must be signed in to change notification settings - Fork 220
feat: rate limiting #1290
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
Merged
Merged
feat: rate limiting #1290
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
caf12d5
refactor: rename JUnit extensions to be more explicit (#1254)
metacosm 4065802
feat: workflow Integration with API (dependent annotations, context) …
csviri 9a8fc20
feat: garbage collected interface (#1164)
csviri 0c74a2d
feat: rate limiting
csviri 46ccd24
test improvement
csviri 114c0be
controller integration
csviri e5277df
Config support start default values
csviri 0b0388a
format
csviri d9a8a16
annotation controller config
csviri e26a789
wip
csviri 28addc8
test fix
csviri 95a7fd5
unit test
csviri 52394dc
integration test added
csviri cd21708
default rate limit
csviri 4c03511
rate limiter turned off by default
csviri 4884a9b
docs
csviri 16f2d57
default change
csviri 50ada53
format
csviri f9e30f0
rebase on next
csviri 398f343
ordering params
csviri c5f1a37
docs: improve/clarify
metacosm aee5d59
fix: do not create a new RateLimiter every time by default
metacosm bc53528
fix: restore backwards compatibility
metacosm 8bd3428
fix: proper cast
metacosm 47ee101
format
csviri 544860a
rebase next
csviri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...or-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/RateLimit.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.javaoperatorsdk.operator.api.reconciler; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import io.javaoperatorsdk.operator.processing.event.rate.PeriodRateLimiter; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE}) | ||
public @interface RateLimit { | ||
|
||
int limitForPeriod() default PeriodRateLimiter.NO_LIMIT_PERIOD; | ||
|
||
int refreshPeriod() default PeriodRateLimiter.DEFAULT_REFRESH_PERIOD_SECONDS; | ||
|
||
/** | ||
* @return time unit for max delay between reconciliations | ||
*/ | ||
TimeUnit refreshPeriodTimeUnit() default TimeUnit.SECONDS; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
This will need to be fixed as this doesn't make any sense if users can provide their own
RateLimiter
implementations…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.
The idea is that some can configure basic rate limit, what is usuabble in most of the cases. If the default implementation does not fit, configuration overrride still can be used.
Note that this is empty by default, so there is no default rate limiter.