-
Notifications
You must be signed in to change notification settings - Fork 585
Add GRPCRoute weighted backendRefs test #3962
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
Add GRPCRoute weighted backendRefs test #3962
Conversation
Welcome @sarthyparty! |
Hi @sarthyparty. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
Question for the maintainers, since |
/ok-to-test |
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.
Can you also add the tests in conformance/tests/mesh/
Good question. I think this is a core feature of GRPCRoute, meaning everyone who supports GRPCRoute is expected to support this. You are right that we did not have conformance for that (which is sub-optimal) but the implementors of this should have already supported this feature. So I think adding coverage is good, and if we break someone - thats a good sign they should fix it, cause the promise we give to our users is that weights are supported with grpcRoute /cc @mikemorris @robscott for thoughts |
@LiorLieberman: GitHub didn't allow me to request PR reviews from the following users: for, thoughts. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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-sigs/prow repository. |
Yes, agreed that weighted load-balancing is a Core feature, meaning that support is not optional. So if we break existing implementations, they'll need to fix it before they can claim support for the release this is included in (that is, v1.4). |
/retest |
@sarthyparty ping on this in case you missed that part of the comment |
Oh shoot thanks for ping I missed it. Also I'll fix the lint issue |
41fa6c3
to
bef25ff
Compare
@LiorLieberman Do you want me to add gRPC mesh setup for testing? There doesn't seem to be any GRPC tests there. Or did you just mean to refactor the existing http weight test to use the shared func? |
I dont think you need any special setup beyond what we already have in mesh base manifests for conformance. (feel free to shout if I am missing something here). I did mean to add grpc test to this folder as well, so it adds mesh coverage for that. |
/assign |
return resp.Response.GetAssertions().GetContext().GetPod(), nil | ||
}) | ||
|
||
for i := 0; i < 10; i++ { |
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.
do we have a retries constant defined? use that instead?
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.
Sure, good point
conformance/utils/echo/pod.go
Outdated
// Handle status code comparison based on protocol | ||
expectedCode := fmt.Sprint(wantResp.StatusCode) | ||
if strings.ToLower(exp.Request.Protocol) == "grpc" { | ||
// For gRPC, HTTP 200 maps to gRPC status 0 (OK), but the echo client | ||
// seems to report HTTP status codes even for gRPC requests | ||
if wantResp.StatusCode == 200 && resp.Code == "200" { | ||
// Both expect and got HTTP 200, which is fine for gRPC success | ||
expectedCode = "200" | ||
} else if wantResp.StatusCode == 200 { | ||
expectedCode = "0" | ||
} | ||
} | ||
if expectedCode != resp.Code { | ||
return fmt.Errorf("wanted status code %v, got %v", expectedCode, resp.Code) | ||
} |
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.
I'm not sure if this logic is testing what we want for gRPC requests, specifically I believe // Both expect and got HTTP 200, which is fine for gRPC success
is insufficient - it's only checking the "outer" initial HTTP connection and not the "inner" gRPC request/response?
/cc @LiorLieberman
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 that's a good point, I don't know if it's possible to get the grpc status code with the istio client. Maybe need to setup a different grpc calling system. Although according to Lior's earlier comment, it seems as though the client will error if there's a grpc error, so perhaps 200 is good enough?
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.
I do think it would be preferable if we can affirmatively test the actual gRPC response code (which does sound like it would require changes to the client).
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.
I don't think I can change the istio client code itself (currently the test works by execing into echo pod and running client grpc://url). Do you have any ideas on the best way how I can make the grpc request from the pod without using client?
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.
Ah I see we're just using the retagged Istio image - @LiorLieberman @howardjohn do y'all know where the source for this is?
I'm guessing that modifying the source would be disruptive for Istio - unsure if this is maybe a sufficient justification to fork and take ownership of this util ourselves for our tests.
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.
It dont think it would be disruptive for istio, John is open for changes/improvements. I also think it makes sense but maybe not a MUST now
I ran this test locally with the snippet @LiorLieberman provided in #3962 (comment) and while it at least did run to completion (with the caveat in my prior comment about checking HTTP success and not the inner gRPC response), it appears as if Istio might not support this weighting as is currently written in the test - is this expected? A quick glance at the implementation looks like the GRPCRoute builder is attempting to include weighting...
EDIT: integer values were provided in the YAML, so something else is off here...
|
- backendRefs: | ||
- name: echo-v1 | ||
port: 7070 | ||
weight: 70 | ||
- name: echo-v2 | ||
port: 7070 | ||
weight: 30 |
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.
- backendRefs: | |
- name: echo-v1 | |
port: 7070 | |
weight: 70 | |
- name: echo-v2 | |
port: 7070 | |
weight: 30 | |
- backendRefs: | |
- name: echo-v1 | |
port: 7070 | |
weight: 70 | |
- name: echo-v2 | |
port: 7070 | |
weight: 30 | |
- name: echo-v3 | |
port: 7070 | |
weight: 0 |
We should probably include the third zero-weight backend for parity with the N/S test I think?
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.
Sure that sounds good to me
When I ran the test locally on istio it has passed. I'm not completely sure why it seems to fail for others. I did have cleanup on, not sure if that makes a difference |
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.
how do you run it, can you paste the command and the output you have (make sure its verbose)
I ran
Here is test-output.txt Here's just the bottom:
EDIT: Pasted output into a google doc so its not a suspicious link |
Thanks for all the hard work and navigating through the back-and-forth @sarthyparty ! I am bumping this in the group chat for final set of eyes, but I think I am good to go with this. |
Whats the status here @mikemorris ? |
I apparently ran the conformance test without first installing Istio on the cluster (and on rerunning, forgetting to restart the conformance test pods to ensure sidecars were injected), which completely explains why traffic would have been split equally and not weighted as expected. After ensuring Istio was installed and prior runs were cleaned up before running the conformance tests this now passes fine for me in sidecar mode. I additionally tested on Istio's ambient mode, which fails by default (expected with only ztunnel which doesn't handle L7) when run with:
and passes after deploying a waypoint and running the test with the requisite namespace labels!
After we add the /lgtm |
Thanks @mikemorris ! @sarthyparty - can you fix the verify? /retest |
0709f9d
to
21dd149
Compare
@LiorLieberman Fixed the verify |
Thank you for all the hard work on this @sarthyparty /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: LiorLieberman, sarthyparty The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind test
What this PR does / why we need it:
Adds GRPCRoute weighted BackendRefs test. Increase conformance feature coverage of GRPCRoute
Which issue(s) this PR fixes:
Fixes #2901
Does this PR introduce a user-facing change?: