Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/v1alpha1/fault_injection.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ type FaultInjectionAbort struct {
// GrpcStatus specifies the GRPC status code to be returned
//
// +optional
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=16
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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%.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ spec:
description: GrpcStatus specifies the GRPC status code to
be returned
format: int32
maximum: 16
minimum: 0
type: integer
httpStatus:
description: StatusCode specifies the HTTP status code to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ spec:
description: GrpcStatus specifies the GRPC status code to
be returned
format: int32
maximum: 16
minimum: 0
type: integer
httpStatus:
description: StatusCode specifies the HTTP status code to
Expand Down
2 changes: 1 addition & 1 deletion internal/gatewayapi/backendtrafficpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@ func (t *Translator) buildFaultInjection(policy *egv1a1.BackendTrafficPolicy) *i
}

if policy.Spec.FaultInjection.Abort.GrpcStatus != nil {
fi.Abort.GrpcStatus = policy.Spec.FaultInjection.Abort.GrpcStatus
fi.Abort.GrpcStatus = new(uint32(*policy.Spec.FaultInjection.Abort.GrpcStatus))
}
if policy.Spec.FaultInjection.Abort.HTTPStatus != nil {
fi.Abort.HTTPStatus = policy.Spec.FaultInjection.Abort.HTTPStatus
Expand Down
2 changes: 1 addition & 1 deletion internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ type FaultInjectionAbort struct {
// HTTPStatus defines the HTTP status code to be returned.
HTTPStatus *int32 `json:"httpStatus,omitempty" yaml:"httpStatus,omitempty"`
// GrpcStatus defines the gRPC status code to be returned.
GrpcStatus *int32 `json:"grpcStatus,omitempty" yaml:"grpcStatus,omitempty"`
GrpcStatus *uint32 `json:"grpcStatus,omitempty" yaml:"grpcStatus,omitempty"`
// Percentage defines the percentage of requests to be aborted.
Percentage *float32 `json:"percentage,omitempty" yaml:"percentage,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion internal/ir/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/xds/translator/fault.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (*fault) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTP
}
if abort.GrpcStatus != nil {
routeCfgProto.Abort.ErrorType = &xdshttpfaultv3.FaultAbort_GrpcStatus{
GrpcStatus: uint32(*abort.GrpcStatus),
GrpcStatus: *abort.GrpcStatus,
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/helm/gateway-crds-helm/all.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22876,6 +22876,8 @@ spec:
description: GrpcStatus specifies the GRPC status code to
be returned
format: int32
maximum: 16
minimum: 0
type: integer
httpStatus:
description: StatusCode specifies the HTTP status code to
Expand Down
2 changes: 2 additions & 0 deletions test/helm/gateway-crds-helm/e2e.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,8 @@ spec:
description: GrpcStatus specifies the GRPC status code to
be returned
format: int32
maximum: 16
minimum: 0
type: integer
httpStatus:
description: StatusCode specifies the HTTP status code to
Expand Down
2 changes: 2 additions & 0 deletions test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,8 @@ spec:
description: GrpcStatus specifies the GRPC status code to
be returned
format: int32
maximum: 16
minimum: 0
type: integer
httpStatus:
description: StatusCode specifies the HTTP status code to
Expand Down
Loading