-
Notifications
You must be signed in to change notification settings - Fork 608
add admission control functionality #7529
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
Open
aburan28
wants to merge
4
commits into
envoyproxy:main
Choose a base branch
from
aburan28:adam--add-admission-control
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| // Copyright Envoy Gateway Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // The full text of the Apache license is available in the LICENSE file at | ||
| // the root of the repo. | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // AdmissionControl defines the admission control policy to be applied. | ||
| // This configuration probabilistically rejects requests based on the success rate | ||
| // of previous requests in a configurable sliding time window. | ||
| type AdmissionControl struct { | ||
| // Enabled enables or disables the admission control filter. | ||
| // Defaults to true if not specified. | ||
| // | ||
| // +optional | ||
| Enabled *bool `json:"enabled,omitempty"` | ||
|
|
||
| // SamplingWindow defines the time window over which request success rates are calculated. | ||
| // Defaults to 60s if not specified. | ||
| // | ||
| // +optional | ||
| SamplingWindow *metav1.Duration `json:"samplingWindow,omitempty"` | ||
|
|
||
| // SuccessRateThreshold defines the lowest request success rate at which the filter | ||
| // will not reject requests. The value should be in the range [0.0, 1.0]. | ||
| // Defaults to 0.95 (95%) if not specified. | ||
| // | ||
| // +optional | ||
| // +kubebuilder:validation:Minimum=0.0 | ||
| // +kubebuilder:validation:Maximum=1.0 | ||
| SuccessRateThreshold *float64 `json:"successRateThreshold,omitempty"` | ||
|
|
||
| // Aggression controls the rejection probability curve. A value of 1.0 means a linear | ||
| // increase in rejection probability as the success rate decreases. Higher values | ||
| // result in more aggressive rejection at higher success rates. | ||
| // Defaults to 1.0 if not specified. | ||
| // | ||
| // +optional | ||
| // +kubebuilder:validation:Minimum=0.0 | ||
| Aggression *float64 `json:"aggression,omitempty"` | ||
|
|
||
| // RPSThreshold defines the minimum requests per second below which requests will | ||
| // pass through the filter without rejection. Defaults to 1 if not specified. | ||
| // | ||
| // +optional | ||
| // +kubebuilder:validation:Minimum=0 | ||
| RPSThreshold *uint32 `json:"rpsThreshold,omitempty"` | ||
|
|
||
| // MaxRejectionProbability represents the upper limit of the rejection probability. | ||
| // The value should be in the range [0.0, 1.0]. Defaults to 0.95 (95%) if not specified. | ||
| // | ||
| // +optional | ||
| // +kubebuilder:validation:Minimum=0.0 | ||
| // +kubebuilder:validation:Maximum=1.0 | ||
| MaxRejectionProbability *float64 `json:"maxRejectionProbability,omitempty"` | ||
|
|
||
| // SuccessCriteria defines what constitutes a successful request for both HTTP and gRPC. | ||
| // | ||
| // +optional | ||
| SuccessCriteria *AdmissionControlSuccessCriteria `json:"successCriteria,omitempty"` | ||
| } | ||
|
|
||
| // AdmissionControlSuccessCriteria defines the criteria for determining successful requests. | ||
| type AdmissionControlSuccessCriteria struct { | ||
| // HTTP defines success criteria for HTTP requests. | ||
| // | ||
| // +optional | ||
| HTTP *HTTPSuccessCriteria `json:"http,omitempty"` | ||
|
|
||
| // GRPC defines success criteria for gRPC requests. | ||
| // | ||
| // +optional | ||
| GRPC *GRPCSuccessCriteria `json:"grpc,omitempty"` | ||
| } | ||
|
|
||
| // HTTPSuccessCriteria defines success criteria for HTTP requests. | ||
| type HTTPSuccessCriteria struct { | ||
| // HTTPSuccessStatus defines ranges of HTTP status codes that are considered successful. | ||
| // Each range is inclusive on both ends. | ||
| // | ||
| // +optional | ||
| HTTPSuccessStatus []HTTPStatusRange `json:"httpSuccessStatus,omitempty"` | ||
| } | ||
|
|
||
| // HTTPStatusRange defines a range of HTTP status codes. | ||
| type HTTPStatusRange struct { | ||
| // Start is the inclusive start of the status code range (100-600). | ||
| // | ||
| // +kubebuilder:validation:Minimum=100 | ||
| // +kubebuilder:validation:Maximum=600 | ||
| Start int32 `json:"start"` | ||
|
|
||
| // End is the inclusive end of the status code range (100-600). | ||
| // | ||
| // +kubebuilder:validation:Minimum=100 | ||
| // +kubebuilder:validation:Maximum=600 | ||
| End int32 `json:"end"` | ||
| } | ||
|
|
||
| // GRPCSuccessCriteria defines success criteria for gRPC requests. | ||
| type GRPCSuccessCriteria struct { | ||
| // GRPCSuccessStatus defines gRPC status codes that are considered successful. | ||
| // | ||
| // +optional | ||
| GRPCSuccessStatus []int32 `json:"grpcSuccessStatus,omitempty"` | ||
| } | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
A bool field with a default of true is a little counter-intuitive. Would it make sense to flip the flag and call it
PassThrough? Or maybe we could drop it for the firt iteration.