-
Notifications
You must be signed in to change notification settings - Fork 382
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
API: Support FaultInjection in BackendTrafficPolicy #2304
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8015f1e
API: Support FaultInjection in BackendTrafficPolicy
c5221fe
fix api and update cel
c5fcea9
fix fault injection api
efc14de
Merge branch 'main' into dev-add-fault-injection
7fddc46
merge main to solve conflict
fcd4f79
Merge branch 'main' into dev-add-fault-injection
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 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 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,62 @@ | ||
// 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" | ||
|
||
// FaultInjection defines the fault injection policy to be applied. This configuration can be used to | ||
// inject delays and abort requests to mimic failure scenarios such as service failures and overloads | ||
// +union | ||
// | ||
// +kubebuilder:validation:XValidation:rule=" has(self.delay) || has(self.abort) ",message="Delay and abort faults are set at least one." | ||
type FaultInjection struct { | ||
|
||
// If specified, a delay will be injected into the request. | ||
// | ||
// +optional | ||
Delay *FaultInjectionDelay `json:"delay,omitempty"` | ||
|
||
// If specified, the request will be aborted if it meets the configuration criteria. | ||
// | ||
// +optional | ||
Abort *FaultInjectionAbort `json:"abort,omitempty"` | ||
} | ||
|
||
// FaultInjectionDelay defines the delay fault injection configuration | ||
type FaultInjectionDelay struct { | ||
// FixedDelay specifies the fixed delay duration | ||
// | ||
// +required | ||
FixedDelay *metav1.Duration `json:"fixedDelay"` | ||
|
||
// Percentage specifies the percentage of requests to be delayed. Default 100%, if set 0, no requests will be delayed. Accuracy to 0.0001%. | ||
// +optional | ||
// +kubebuilder:default=100 | ||
Percentage *float32 `json:"percentage,omitempty"` | ||
} | ||
|
||
// FaultInjectionAbort defines the abort fault injection configuration | ||
// +union | ||
// | ||
// +kubebuilder:validation:XValidation:rule=" !(has(self.httpStatus) && has(self.grpcStatus)) ",message="httpStatus and grpcStatus cannot be simultaneously defined." | ||
// +kubebuilder:validation:XValidation:rule=" has(self.httpStatus) || has(self.grpcStatus) ",message="httpStatus and grpcStatus are set at least one." | ||
type FaultInjectionAbort struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also missing |
||
// StatusCode specifies the HTTP status code to be returned | ||
// | ||
// +optional | ||
// +kubebuilder:validation:Minimum=200 | ||
// +kubebuilder:validation:Maximum=600 | ||
HTTPStatus *int32 `json:"httpStatus,omitempty"` | ||
|
||
// GrpcStatus specifies the GRPC status code to be returned | ||
// | ||
// +optional | ||
GrpcStatus *int32 `json:"grpcStatus,omitempty"` | ||
|
||
// Percentage specifies the percentage of requests to be aborted. Default 100%, if set 0, no requests will be aborted. Accuracy to 0.0001%. | ||
// +optional | ||
Percentage *float32 `json:"percentage,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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.
is L45 needed ?
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.
yeah,an error type must be set(not provide default behavior for abort fault),https://github.com/envoyproxy/envoy/blob/6b152468de33832161951348aac5e2219935f258/api/envoy/extensions/filters/http/fault/v3/fault.proto#L41C1-L52C4