-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API: Support FaultInjection in BackendTrafficPolicy
Signed-off-by: zhaonan <[email protected]>
- Loading branch information
zhaonan
committed
Dec 15, 2023
1 parent
9aebfdc
commit c197ba1
Showing
5 changed files
with
216 additions
and
0 deletions.
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,48 @@ | ||
// 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. Support delays and aborts. | ||
type FaultInjection struct { | ||
|
||
// If specified, the delay will inject a fixed delay into the request | ||
// | ||
// +optional | ||
Delay *DelayConfig `json:"delay,omitempty"` | ||
|
||
// If specified, the abort will abort the request with the specified HTTP status code | ||
// | ||
// +optional | ||
Abort *AbortConfig `json:"abort,omitempty"` | ||
} | ||
|
||
// DelayConfig defines the delay fault injection configuration | ||
type DelayConfig 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. | ||
// +optional | ||
// +kubebuilder:default=100 | ||
Percentage *int `json:"percentage"` | ||
} | ||
|
||
// AbortConfig defines the abort fault injection configuration | ||
type AbortConfig struct { | ||
// StatusCode specifies the HTTP/GRPC status code to be returned | ||
// | ||
// +required | ||
StatusCode *int `json:"statusCode"` | ||
|
||
// Percentage specifies the percentage of requests to be aborted. Default 100%, if set 0, no requests will be aborted. | ||
// +optional | ||
// +kubebuilder:default=100 | ||
Percentage *int `json:"percentage"` | ||
} |
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