-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 AdmissionController interface #3716
Conversation
✅ Gradle Check success 213ce6b51d023710f8732979a4cebcdce45c02fa |
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 interface needs to be included in a PR that implements it and includes some kind of tests. We don't merge PRs for unused interfaces. If this is a merge of a fairly large downstream implementation make sure it's split into smaller incremental PRs.
Also, we'll want to feature flag this so we can let it bake before releasing GA.
* Provides methods for any tracking-object that can be incremented (such as memory size), | ||
* Admission control can be applied if configured limit has been reached. | ||
*/ | ||
public interface AdmissionController { |
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.
Do we intend for plugins to be able to implement this interface? Can we make this package private?
If not please mark this with an appropriate opensearch annotation (@opensearch.internal
, @opensearch.experimental
, @opensearch.api
) to document extensibility restrictions.
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 interface needs to be included in a PR that implements it and includes some kind of tests. We don't merge PRs for unused interfaces. If this is a merge of a fairly large downstream implementation make sure it's split into smaller incremental PRs.
Also, we'll want to feature flag this so we can let it bake before releasing GA.
Thanks for the feedback @nknize
I planned to raise implementations as part of next pull-requests to keep scope of each pull-request smaller.
I will update this pull request with other suggested changes.
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.
Do we intend for plugins to be able to implement this interface? Can we make this package private?
Made it package private as it is not intended for plugins to implement this interface.
Also, we'll want to feature flag this so we can let it bake before releasing GA.
Yes, this feature will be behind dynamic setting.
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.
Thanks for including the requested changes. But we do need to include this interface in a PR that implements it and includes some kind of tests. We don't merge PRs with unused interfaces. If this is a merge of a fairly large downstream implementation make sure it's split into smaller incremental PRs. Can you at least include this with some part of a mechanism that uses it?
+1 on @nknize on having one of the implementations out before we merge just the interface. However, the only difficulty I see is that if we do as a separate followup PR, it will fail checks since interface is not yet available in the core. @mitalawachat Can we have one of the smaller implementations added to this same PR. That will help validate the consistency and completeness of the Interface being added. However, if it consists of bigger chunk of changes and we wish to break them up into multiple followup PRs, we should discuss the possibility of a feature-branch as well. |
76ec5e2
to
03844be
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Mital Awachat <[email protected]>
Signed-off-by: Mital Awachat <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
|
||
@Override | ||
public String toString() { | ||
return "AdmissionControlSetting{" + "name='" + name + '\'' + ", enabled=" + enabled + ", limit=" + limits + '}'; |
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.
Will fix this along with review comments.
/** | ||
* @return current value of the rejection count metric tracked by the admission-controller. | ||
*/ | ||
long getRejectionCount(); | ||
|
||
/** | ||
* Adds the rejection count for the controller. Primarily used when copying controller states. | ||
* @param count To add the value of the tracking resource object as the provided count | ||
* @return count/value by which the resource tracking object is updated with. | ||
*/ | ||
long addRejectionCount(long count); | ||
|
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.
Can metric tracking be modelled as a listener
@Override | ||
public long setInitialQuota(long count) { | ||
usedBytes.set(count); | ||
return usedBytes.get(); | ||
} |
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.
do we need a reset? or can it called as a part of the constructor
@mitalawachat : Are you still working on this ? |
We can mark this PR as closed as it requires additional discussion if Admission Control needs to be part of core or can it be a separate plugin all together. |
* | ||
* @opensearch.internal | ||
*/ | ||
class AdmissionControlSetting { |
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.
We should allow each admission controller to bring their own settings, rather than enforcing this fixed format.
/** | ||
* Increment the tracking-object with provided value. | ||
* Apply the admission control if threshold is breached. | ||
* Mostly applicable while acquiring the quota. | ||
* Later Releasable is used to decrement the tracking-object with previously acquired value. | ||
* | ||
* @param count value to incrementation the resource racking-object with. | ||
* @return Releasable for tokens acquired from the resource tracking object. | ||
*/ | ||
Releasable addBytesAndMaybeBreak(long count); | ||
|
||
/** | ||
* Sets the initial used quota for the controller. Primarily used when copying controller states. | ||
* @param count To set the value of the tracking resource object as the provided count | ||
* @return count/value by which the resource tracking object is updated with. | ||
*/ | ||
long setInitialQuota(long count); | ||
|
||
/** | ||
* @return currently acquired value of the tracking-object being tracked by the admission-controller. | ||
*/ | ||
long getUsedQuota(); | ||
|
||
/** | ||
* @return current value of the rejection count metric tracked by the admission-controller. | ||
*/ | ||
long getRejectionCount(); | ||
|
||
/** | ||
* Adds the rejection count for the controller. Primarily used when copying controller states. | ||
* @param count To add the value of the tracking resource object as the provided count | ||
* @return count/value by which the resource tracking object is updated with. | ||
*/ | ||
long addRejectionCount(long count); |
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.
I feel that these interface methods model each admission controller as a token-bucket, which is not always true. For example, an admission controller which only looks at the node's CPU/memory usage doesn't need to acquire/release any tokens.
* Admission Controllers | ||
*/ | ||
public enum Controllers { | ||
REQUEST_SIZE("RequestSize"); |
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.
I'm not sure why this belongs here. We should make admission controllers pluggable.
Signed-off-by: Mital Awachat [email protected]
Description
This pull request serves as a starting point for Admission Control. In this pull request we are adding AdmissionController interface which will be fulfilled by concrete implementation in subsequent pull requests as mentioned in design proposal given below.
Issues Resolved
Feature Proposal: #1144
Design Proposal: #3400
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.