Skip to content

Support sendInitialEvents in the dynamic client watch - #2703

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-client:masterfrom
chala2001:dynamic-send-initial-events
Sep 8, 2026
Merged

Support sendInitialEvents in the dynamic client watch#2703
kubernetes-prow[bot] merged 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`.

@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
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
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.
@chala2001
chala2001 force-pushed the dynamic-send-initial-events branch from 6feb428 to 558230f Compare September 2, 2026 06:19
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 2, 2026
@chala2001

chala2001 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@yliaog could you approve the workflow run here? It's been sitting at "action_required" since I opened it, so there are no CI results yet.

I rebased onto master yesterday for the kubernetes/base cleanup ,,same change, just moved to kubernetes/dynamic/. Tests pass locally

@yliaog

yliaog commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

thanks for the PR

/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 8, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chala2001, yliaog

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

The pull request process is described 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit e24ea6b into kubernetes-client:master Sep 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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

2 participants