Skip to content
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

conformance tests for percentage-based request mirroring #3508

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

LiorLieberman
Copy link
Member

@LiorLieberman LiorLieberman commented Dec 17, 2024

What type of PR is this?
/kind test
/area conformance

What this PR does / why we need it:
Conformance tests for #3171 plus small updates to the GEP.
Tested with istio 1.24.1

Note: I also added a test case for fraction but it looks like it has an issue currently with the implementation I used (istio).

The specific test is failing, (which is good) so I think its in a good merge state. I also opened istio/istio#54357.

Mesh tests to follow

Which issue(s) this PR fixes:
Fixes #3171

Does this PR introduce a user-facing change?:

NONE

/cc @jakebennert @robscott

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/test area/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 17, 2024
@k8s-ci-robot k8s-ci-robot added kind/gep PRs related to Gateway Enhancement Proposal(GEP) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 17, 2024
@LiorLieberman LiorLieberman force-pushed the percent-based-mirror branch 3 times, most recently from 117f34b to d63225c Compare December 17, 2024 03:12
@LiorLieberman LiorLieberman changed the title initial conformance tests for percent based mirroring conformance tests for percentage-based request mirroring Dec 17, 2024
@LiorLieberman
Copy link
Member Author

/cc @jakebennert @robscott

@k8s-ci-robot
Copy link
Contributor

@LiorLieberman: GitHub didn't allow me to request PR reviews from the following users: jakebennert.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @jakebennert @robscott

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.

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @LiorLieberman! This is really well done

conformance/tests/httproute-request-percentage-mirror.go Outdated Show resolved Hide resolved
conformance/tests/httproute-request-percentage-mirror.go Outdated Show resolved Hide resolved
conformance/tests/httproute-request-percentage-mirror.go Outdated Show resolved Hide resolved
conformance/tests/httproute-request-percentage-mirror.go Outdated Show resolved Hide resolved
geps/gep-3171/index.md Outdated Show resolved Hide resolved
geps/gep-3171/index.md Show resolved Hide resolved
@robscott
Copy link
Member

/cc @dprotaso

@LiorLieberman
Copy link
Member Author

/cc @kflynn

@k8s-ci-robot k8s-ci-robot requested a review from kflynn December 20, 2024 01:40
@LiorLieberman
Copy link
Member Author

ping @kflynn @dprotaso
/cc @mikemorris

Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @LiorLieberman!

pkg/features/httproute.go Outdated Show resolved Hide resolved
Features: []features.FeatureName{
features.SupportGateway,
features.SupportHTTPRoute,
// features.SupportHTTPRouteRequestPercentageMirror,
Copy link
Member

Choose a reason for hiding this comment

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

why is this commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

Forgot to return it, I couldn't find the right command to invoke that will actually perform the test while this feature is added :)

conformance/tests/httproute-request-percentage-mirror.go Outdated Show resolved Hide resolved
Comment on lines 106 to 138
}, {
Request: http.Request{
Path: "/percent-mirror-and-modify-headers",
Headers: map[string]string{
"X-Header-Remove": "remove-val",
"X-Header-Add-Append": "append-val-1",
},
},
ExpectedRequest: &http.ExpectedRequest{
Request: http.Request{
Path: "/percent-mirror-and-modify-headers",
Headers: map[string]string{
"X-Header-Add": "header-val-1",
"X-Header-Add-Append": "append-val-1,header-val-2",
"X-Header-Set": "set-overwrites-values",
},
},
AbsentHeaders: []string{"X-Header-Remove"},
},
Namespace: ns,
Backend: "infra-backend-v1",
MirroredTo: []http.MirroredBackend{
{
BackendRef: http.BackendRef{
Name: "infra-backend-v2",
Namespace: ns,
},
Percent: ptrTo(int32(35)),
},
},
},
Copy link
Member

Choose a reason for hiding this comment

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

Why are we testing it jointly with the requestHeaderModifier filter? To assess that both filters are properly applied?

Copy link
Member Author

Choose a reason for hiding this comment

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

exactly, thats a practice I always used to include in tests I developed. To make sure the feature is not messing up when applied with other standard feature. Does that make sense?

http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expected)

// Override to not have more requests than expected
suite.TimeoutConfig.RequiredConsecutiveSuccesses = 1
Copy link
Member

Choose a reason for hiding this comment

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

This change will affect other tests as well. Why do we need to do so?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh man.. there is a whole story behind this change.
Essentially since I test mirroring, I started to see more requests that I had actually sent. so the mirror expectations were totally wrong. I learned to find this config the hard way..

Any other suggestion here if this is not desired?

Comment on lines +147 to +151
// used to limit number of parallel go routines
semaphore := make(chan struct{}, concurrentRequests)
var wg sync.WaitGroup
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to use concurrent clients here? Correct me If I'm wrong but what we want to check here is:

  • send N requests
  • check all the requests are received by the backend defined in the BackendRef
  • check that n% of the requests are mirrored to the backend set in the mirror filter

Does it accurately summarize what we are trying to do here? If so, to me it's not clear why we do need to implement concurrent clients.

Copy link
Member Author

@LiorLieberman LiorLieberman Jan 10, 2025

Choose a reason for hiding this comment

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

since totalRequests are a high number of request, we are not sending them sequentially. Instead, we sending them in concurrently, BUT we limit the concurrency factor to be 10 (which is why the sempahore is used for).

Also we wrap the above process in loop - cause mirror distributions are not 100% accurate - so we have enough room to make sure it mirrors as expected (or nearly as expected).

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LiorLieberman
Once this PR has been reviewed and has the lgtm label, please assign danwinship for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@LiorLieberman
Copy link
Member Author

@sayboras Can you help testing if CIlium passes this test?

/cc @sayboras

@k8s-ci-robot
Copy link
Contributor

@LiorLieberman: GitHub didn't allow me to request PR reviews from the following users: sayboras.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

@sayboras Can you help testing if CIlium passes this test?

/cc @sayboras

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/gep PRs related to Gateway Enhancement Proposal(GEP) kind/test release-note-none Denotes a PR that doesn't merit a release note. 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.

GEP: Percentage-Based Request Mirroring
4 participants