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

storage/etcd: skip SendInitialEvents if the request is backward compatible #117862

Conversation

p0lyn0mial
Copy link
Contributor

@p0lyn0mial p0lyn0mial commented May 8, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

It turns out that the watch-cache is disabled by default for events resource.

When the WatchList feature is enabled and a watch request for events with empty ListOptions is send. Then default options are applied and the request is passed to the etcd implementation. In the end the request fails because etcd doesn't implement streaming API for alpha.

This PR provides a fix that allows for skipping SendInitialEvents when the request is considered to be backward compatible (thanks @wojtek-t for suggesting it!).

Backward compatibility is defined as RV = "" || RV = "O" and AllowWatchBookmark is set to false.
In that case we rely on

func (wc *watchChan) startWatching(watchClosedCh chan struct{}) {

Which issue(s) this PR fixes:

Fixes ##116357

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 8, 2023
@p0lyn0mial
Copy link
Contributor Author

/assign @wojtek-t

@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 8, 2023
@p0lyn0mial
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-cos-alpha-features

@@ -865,8 +865,12 @@ func growSlice(v reflect.Value, maxCapacity int, sizes ...int) {
}

// Watch implements storage.Interface.Watch.
// TODO(#115478): for beta the WatchList feature also must/should support streaming.
Copy link
Member

Choose a reason for hiding this comment

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

This TODO is somewhat misleading to me. Watch by definition supports streaming :)

We probably want to say sth like:
TODO(...): For beta of WatchList feature, etcd3 implemenation should always support it.

[(or sth like that)]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, reworded the comment.

…tible

otherwise an error will be returned.
backward compatibility is defined as RV = "" || RV = "O" and AllowWatchBookmark is set to false.
in that case we rely on https://github.com/kubernetes/kubernetes/blob/267eb25e60955fe8e438c6311412e7cf7d028acb/staging/src/k8s.io/apiserver/pkg/storage/etcd3/watcher.go#L260
@p0lyn0mial p0lyn0mial force-pushed the upstream-watchlist-etcd-impl-compatibility branch from 7a38647 to f2de1a0 Compare May 8, 2023 13:59
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 8, 2023
@p0lyn0mial
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-cos-alpha-features

@wojtek-t
Copy link
Member

wojtek-t commented May 8, 2023

This LGTM.

I'm holiding this until we have alpha suite passing, feel free to cancel once it passes.

/lgtm
/approve
/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels May 8, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 54f4f81bcb919ebe51c2e8b2ef10b576ecded597

@wojtek-t
Copy link
Member

wojtek-t commented May 8, 2023

/retest

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: p0lyn0mial, wojtek-t

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

The pull request process is described 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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 8, 2023
@p0lyn0mial
Copy link
Contributor Author

I'm holiding this until we have alpha suite passing, feel free to cancel once it passes.

pull-kubernetes-e2e-gce-cos-alpha-features is green, releasing the hold.

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 8, 2023
@k8s-ci-robot k8s-ci-robot merged commit 5fd2959 into kubernetes:master May 8, 2023
13 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone May 8, 2023
@p0lyn0mial
Copy link
Contributor Author

xref: kubernetes/enhancements#3157

@p0lyn0mial p0lyn0mial mentioned this pull request May 9, 2023
12 tasks
@fedebongio
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 11, 2023
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. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants