Support sendInitialEvents in the dynamic client watch - #2703
Open
chala2001 wants to merge 1 commit into
Open
Conversation
watch() had no way to ask the API server to replay the current state before streaming changes. Add send_initial_events and resource_version_match to it, and build both query params in request(), which was dropping them.
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chala2001 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
|
PR needs rebase. DetailsInstructions 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind feature
What this PR does / why we need it:
DynamicClient.watch()had no way to setsendInitialEvents, so a dynamic watch could not ask the server to replay the current state before streaming changes. This addssend_initial_eventsandresource_version_matchand forwards them toWatch.stream().The generated APIs already have both parameters from the OpenAPI spec, so the only gap was the dynamic client.
request()builds its query string by hand and had no entry for either name, so the kwargs would have been dropped on the way out. They are added there too. That also makesresourceVersionMatchwork for plain dynamiclist()calls, where it was silently ignored before.Which issue(s) this PR fixes:
Fixes #2700
Special notes for your reviewer:
Two tests in
client_test.py: one that the parameters reach the watcher, one that they reach the query string. The second is the one that matters, since a passthrough-only test still passes whilerequest()drops them.I kept
send_initial_eventsset whenWatch.stream()re-issues the request after a 410, rather than stripping it, to match how the rest of this layer passes parameters through. There is no client-side check thatresource_version_matchis set, since the API server returnsInvalidfor that itself.This touches the same
watch()signature as #2698, so whichever lands second needs a one line rebase.Does this PR introduce a user-facing change?