Skip to content

Commit f661cda

Browse files
committed
update: grpcstatus type
Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
1 parent a7545ce commit f661cda

11 files changed

Lines changed: 19 additions & 7 deletions

File tree

api/v1alpha1/fault_injection.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ type FaultInjectionAbort struct {
5353
// GrpcStatus specifies the GRPC status code to be returned
5454
//
5555
// +optional
56-
GrpcStatus *int32 `json:"grpcStatus,omitempty"`
56+
// +kubebuilder:validation:Minimum=0
57+
// +kubebuilder:validation:Maximum=16
58+
GrpcStatus *uint32 `json:"grpcStatus,omitempty"`
5759

5860
// Percentage specifies the percentage of requests to be aborted. Default 100%, if set 0, no requests will be aborted. Accuracy to 0.0001%.
5961
// +optional

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ spec:
349349
description: GrpcStatus specifies the GRPC status code to
350350
be returned
351351
format: int32
352+
maximum: 16
353+
minimum: 0
352354
type: integer
353355
httpStatus:
354356
description: StatusCode specifies the HTTP status code to

charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ spec:
348348
description: GrpcStatus specifies the GRPC status code to
349349
be returned
350350
format: int32
351+
maximum: 16
352+
minimum: 0
351353
type: integer
352354
httpStatus:
353355
description: StatusCode specifies the HTTP status code to

internal/ir/xds.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ type FaultInjectionAbort struct {
16551655
// HTTPStatus defines the HTTP status code to be returned.
16561656
HTTPStatus *int32 `json:"httpStatus,omitempty" yaml:"httpStatus,omitempty"`
16571657
// GrpcStatus defines the gRPC status code to be returned.
1658-
GrpcStatus *int32 `json:"grpcStatus,omitempty" yaml:"grpcStatus,omitempty"`
1658+
GrpcStatus *uint32 `json:"grpcStatus,omitempty" yaml:"grpcStatus,omitempty"`
16591659
// Percentage defines the percentage of requests to be aborted.
16601660
Percentage *float32 `json:"percentage,omitempty" yaml:"percentage,omitempty"`
16611661
}

internal/ir/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/xds/translator/fault.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (*fault) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTP
152152
}
153153
if abort.GrpcStatus != nil {
154154
routeCfgProto.Abort.ErrorType = &xdshttpfaultv3.FaultAbort_GrpcStatus{
155-
GrpcStatus: uint32(*abort.GrpcStatus),
155+
GrpcStatus: *abort.GrpcStatus,
156156
}
157157
}
158158
}

test/cel-validation/backendtrafficpolicy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) {
996996
FaultInjection: &egv1a1.FaultInjection{
997997
Abort: &egv1a1.FaultInjectionAbort{
998998
HTTPStatus: new(int32(200)),
999-
GrpcStatus: new(int32(80)),
999+
GrpcStatus: new(uint32(80)),
10001000
},
10011001
},
10021002
}
@@ -1044,7 +1044,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) {
10441044
},
10451045
FaultInjection: &egv1a1.FaultInjection{
10461046
Abort: &egv1a1.FaultInjectionAbort{
1047-
GrpcStatus: new(int32(10)),
1047+
GrpcStatus: new(uint32(10)),
10481048
Percentage: new(float32(20)),
10491049
},
10501050
},

test/helm/gateway-crds-helm/all.out.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22876,6 +22876,8 @@ spec:
2287622876
description: GrpcStatus specifies the GRPC status code to
2287722877
be returned
2287822878
format: int32
22879+
maximum: 16
22880+
minimum: 0
2287922881
type: integer
2288022882
httpStatus:
2288122883
description: StatusCode specifies the HTTP status code to

test/helm/gateway-crds-helm/e2e.out.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,8 @@ spec:
849849
description: GrpcStatus specifies the GRPC status code to
850850
be returned
851851
format: int32
852+
maximum: 16
853+
minimum: 0
852854
type: integer
853855
httpStatus:
854856
description: StatusCode specifies the HTTP status code to

0 commit comments

Comments
 (0)