Skip to content

Support sendInitialEvents in the dynamic client watch - #2703

Open
chala2001 wants to merge 1 commit into
kubernetes-client:masterfrom
chala2001:dynamic-send-initial-events
Open

Support sendInitialEvents in the dynamic client watch#2703
chala2001 wants to merge 1 commit into
kubernetes-client:masterfrom
chala2001:dynamic-send-initial-events

Conversation

@chala2001

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

DynamicClient.watch() had no way to set sendInitialEvents, so a dynamic watch could not ask the server to replay the current state before streaming changes. This adds send_initial_events and resource_version_match and forwards them to Watch.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 makes resourceVersionMatch work for plain dynamic list() 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 while request() drops them.

I kept send_initial_events set when Watch.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 that resource_version_match is set, since the API server returns Invalid for 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?

Dynamic client `watch()` now accepts `send_initial_events` and `resource_version_match`.

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.
@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Sep 1, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

Details 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

@kubernetes-prow
kubernetes-prow Bot requested review from fabianvf and yliaog September 1, 2026 12:28
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 1, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support watch parameter sendInitialEvents

1 participant