Skip to content

Conversation

ckcd
Copy link
Contributor

@ckcd ckcd commented Aug 3, 2020

Implement of grpc status in fault abort.

e.g.

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
...
spec:
  hosts:
  - ratings
  http:
  - fault:
      abort:
        grpcStatus: DEADLINE_EXCEEDED
        percentage:
          value: 100

The related api is in istio/api:virtual_service.proto#L1816 and for now it's hide_from_docs.

And we discuss about whether the type of GrpcStatus should be string or uint32 in #24698. cc @howardjohn

[ ] Configuration Infrastructure
[ ] Docs
[ ] Installation
[X] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure

@ckcd ckcd requested review from a team as code owners August 3, 2020 06:30
@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Aug 3, 2020
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 3, 2020
@istio-testing
Copy link
Collaborator

Hi @ckcd. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

lgtm

@ramaraochavali
Copy link
Contributor

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Aug 3, 2020
@@ -95,6 +97,27 @@ var (
http.MethodTrace: true,
}

// golang supported gRPC status: https://github.com/grpc/grpc-go/blob/master/codes/codes.go
supportedGRPCStatus = map[string]codes.Code{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this duplication and have these code mapping defined at a common place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

any suggestion? cause I cannot find a common place or any types dir. And the route.go(pilot/pkg/...) and validate.go(pkg/...) are in very different path.

Copy link
Contributor

Choose a reason for hiding this comment

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

somewhere in 'pkg/util/grpc.go` ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, I will do this change tomorrow, thanks~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, please take a look.

Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

LGTM but we need to decide if we want string or int. Once we implement it we cannot change

@ckcd ckcd force-pushed the grpc_status branch 2 times, most recently from 61a116a to 23c1cec Compare August 4, 2020 01:57
@ckcd ckcd force-pushed the grpc_status branch 3 times, most recently from 4af88d6 to 297ef8e Compare August 4, 2020 02:12
@ckcd
Copy link
Contributor Author

ckcd commented Aug 4, 2020

/label release-notes-none

@ckcd
Copy link
Contributor Author

ckcd commented Aug 4, 2020

we need to decide if we want string or int. Once we implement it we cannot change

yes it's hard to choose. But I think string is more intuitive and easy-to-use than int though we need do some format conversion.

@ckcd
Copy link
Contributor Author

ckcd commented Aug 4, 2020

BTW seems we need a release-notes-none label.

@howardjohn @ramaraochavali PTAL.

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Aug 7, 2020
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Aug 24, 2020
@ckcd
Copy link
Contributor Author

ckcd commented Aug 24, 2020

@howardjohn @ramaraochavali

PTAL, thanks~

@ckcd
Copy link
Contributor Author

ckcd commented Aug 24, 2020

/test integ-pilot-k8s-tests_istio

@ramaraochavali ramaraochavali added the release-notes-none Indicates a PR that does not require release notes. label Aug 24, 2020
Copy link
Contributor

@ramaraochavali ramaraochavali left a comment

Choose a reason for hiding this comment

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

Thank you

@ramaraochavali
Copy link
Contributor

/test release-notes_istio

@istio-policy-bot istio-policy-bot added the lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while label Sep 23, 2020
@shamsher31 shamsher31 added lifecycle/staleproof Indicates a PR or issue has been deemed to be immune from becoming stale and/or automatically closed and removed lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while labels Sep 23, 2020
@@ -921,8 +922,13 @@ func translateFault(in *networking.HTTPFaultInjection) *xdshttpfault.HTTPFault {
out.Abort.ErrorType = &xdshttpfault.FaultAbort_HttpStatus{
HttpStatus: uint32(a.HttpStatus),
}
case *networking.HTTPFaultInjection_Abort_GrpcStatus:
code := grpcutil.SupportedGRPCStatus[a.GrpcStatus]
Copy link
Member

Choose a reason for hiding this comment

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

@ckcd What if an invalid gRPC status code is passed? Is the status code validated somewhere before the lookup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's in pkg/config/validation/validation.go in this PR.

@ckcd
Copy link
Contributor Author

ckcd commented Sep 25, 2020

/test integ-pilot-multicluster-tests_istio

@ckcd
Copy link
Contributor Author

ckcd commented Sep 25, 2020

@howardjohn @rshriram @linsun @costinm
please take a look, thanks.

@@ -1994,6 +1994,13 @@ func validateHTTPStatus(status int32) error {
return nil
}

func validateGPRCStatus(status string) error {
if _, ok := grpcutil.SupportedGRPCStatus[status]; !ok {
Copy link
Member

Choose a reason for hiding this comment

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

I suspect a user may get confused by this. Can we expand this to say something like:

gRPC status "foo" is not supported. See https://github.com/grpc/grpc/blob/master/doc/statuscodes.md for a list of supported codes, for example "NOT_FOUND"`

This makes it clear that not_found or 5 are not valid.

Copy link
Member

Choose a reason for hiding this comment

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

Can you add this?

@istio-testing
Copy link
Collaborator

@ckcd: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Dec 5, 2020
@110y
Copy link
Contributor

110y commented Jan 12, 2021

@ckcd @howardjohn

I'd like to use the fault injection for gRPC, so what's the current status of this PR?

@istio-testing
Copy link
Collaborator

@ckcd: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
integ-cni-k8s-tests_istio 06bf31e link /test integ-cni-k8s-tests_istio
integ-istiodremote-k8s-tests_istio 06bf31e link /test integ-istiodremote-k8s-tests_istio
integ-pilot-istiodremote-tests_istio 06bf31e link /test integ-pilot-istiodremote-tests_istio
integ-telemetry-istiodremote-tests_istio 06bf31e link true /test integ-telemetry-istiodremote-tests_istio
integ-pilot-istiodremote-multicluster-tests_istio 06bf31e link true /test integ-pilot-istiodremote-multicluster-tests_istio
integ-security-istiodremote-tests_istio 06bf31e link true /test integ-security-istiodremote-tests_istio
integ-cni_istio 06bf31e link true /test integ-cni_istio
integ-telemetry_istio 06bf31e link true /test integ-telemetry_istio
integ-distroless_istio 06bf31e link true /test integ-distroless_istio
integ-operator-controller_istio 06bf31e link true /test integ-operator-controller_istio
integ-helm_istio 06bf31e link true /test integ-helm_istio
integ-pilot_istio 06bf31e link true /test integ-pilot_istio
integ-security_istio 06bf31e link true /test integ-security_istio

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@howardjohn
Copy link
Member

Would be great to revive this (and add integ test at

)

su225 added a commit to su225/istio that referenced this pull request Jun 6, 2022
Signed-off-by: su225 <suchithjn22@gmail.com>
istio-testing pushed a commit that referenced this pull request Jun 6, 2022
…ault injection) (#39295)

* resurrect PR - #26059

Signed-off-by: su225 <suchithjn22@gmail.com>

* add gRPC status checker

Signed-off-by: su225 <suchithjn22@gmail.com>

* add gRPC abort integration test

Signed-off-by: su225 <suchithjn22@gmail.com>

* add release notes

Signed-off-by: su225 <suchithjn22@gmail.com>

* make linter happy

* fix release notes

Signed-off-by: su225 <suchithjn22@gmail.com>
@howardjohn
Copy link
Member

Merged in #39295. Thanks!

@howardjohn howardjohn closed this Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. lifecycle/staleproof Indicates a PR or issue has been deemed to be immune from becoming stale and/or automatically closed needs-rebase Indicates a PR needs to be rebased before being merged ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. release-notes-none Indicates a PR that does not require release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants