Skip to content

grpcproxy: add support for WatchRequest_ProgressRequest #19711

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexandrevilain
Copy link

Fixes #19710

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: alexandrevilain
Once this PR has been reviewed and has the lgtm label, please assign ahrtr 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

@k8s-ci-robot
Copy link

Hi @alexandrevilain. Thanks for your PR.

I'm waiting for a etcd-io 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-sigs/prow repository.

@alexandrevilain alexandrevilain force-pushed the fix/grpcproxy/support-progress-requests branch from cc944d6 to 4b202ef Compare April 4, 2025 13:58
@alexandrevilain alexandrevilain force-pushed the fix/grpcproxy/support-progress-requests branch from 4b202ef to 8b9dd9a Compare April 7, 2025 07:51
@k8s-ci-robot k8s-ci-robot added size/M and removed size/S labels Apr 7, 2025
@henrybear327
Copy link
Contributor

/ok-to-test

Copy link

codecov bot commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 68.75000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 68.76%. Comparing base (d6416b8) to head (63e4f0b).
Report is 70 commits behind head on main.

Files with missing lines Patch % Lines
server/proxy/grpcproxy/watch.go 61.53% 3 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
server/proxy/grpcproxy/watcher.go 92.15% <100.00%> (+0.32%) ⬆️
server/proxy/grpcproxy/watch.go 91.39% <61.53%> (-1.09%) ⬇️

... and 47 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #19711      +/-   ##
==========================================
+ Coverage   65.98%   68.76%   +2.78%     
==========================================
  Files         421      421              
  Lines       35857    35878      +21     
==========================================
+ Hits        23659    24673    +1014     
+ Misses      10791     9766    -1025     
- Partials     1407     1439      +32     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6416b8...63e4f0b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexandrevilain
Copy link
Author

/retest

@alexandrevilain alexandrevilain force-pushed the fix/grpcproxy/support-progress-requests branch from 8b9dd9a to add9f2b Compare April 22, 2025 09:04
@alexandrevilain
Copy link
Author

/retest

@alexandrevilain alexandrevilain force-pushed the fix/grpcproxy/support-progress-requests branch from add9f2b to 3c48c1f Compare April 22, 2025 09:34
// Enable the progress notify on the watcher, otherwise the send()
// method may drop progress events.
if !w.progress {
w.progress = true
Copy link
Member

@serathius serathius Apr 22, 2025

Choose a reason for hiding this comment

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

This is not the same progress notification source. In etcd there are two ways to get progress notification:

  • Server configures a periodic progress notification period and client requests getting periodic notification. For example if it's configured for 5s, and there was no normal event in watch for 5s, server should send a notification to watch.
  • Client requested notification, client can at any moment request a notification and server should imminently give a response about a watch progress.

This PR mixes those two, where it configures a grpc proxy to response to requested notification by enabling periodic notification.

Copy link
Author

@alexandrevilain alexandrevilain Apr 22, 2025

Choose a reason for hiding this comment

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

Thanks for the explanation @serathius!

Just to clarify, are you saying I shouldn't permanently enable progress notifications on the watcher?
Instead, should I implement something like a one-time toggle on the watcher side to allow a notification for the next request only?

So, when the proxy receives a new WatchRequest_ProgressRequest, it would set this toggle to true and call RequestProgress on the server.
Then, once the proxy receives the progress notification, it sends it to the client and resets the toggle back to false.
Is that the intended behavior?

Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify, are you saying I shouldn't permanently enable progress notifications on the watcher?
Instead, should I implement something like a one-time toggle on the watcher side to allow a notification for the next request only?

Yes

So, when the proxy receives a new WatchRequest_ProgressRequest, it would set this toggle to true and call RequestProgress on the server.
Then, once the proxy receives the progress notification, it sends it to the client and resets the toggle back to false.
Is that the intended behavior?

I haven't dive into what exactly the toggle does, but my initial thinking is that grpcproxy should just proxy WatchRequest_ProgressRequest request.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks.
I've reworked the code to support both types of progress notifications.
Let me know if this looks better.

@alexandrevilain alexandrevilain force-pushed the fix/grpcproxy/support-progress-requests branch from 3c48c1f to 26c34e3 Compare April 23, 2025 09:21
@alexandrevilain alexandrevilain force-pushed the fix/grpcproxy/support-progress-requests branch from 26c34e3 to 63e4f0b Compare April 24, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Missing support for ProgressRequest in gRPC proxy
5 participants