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

Fix bug in reflector not detecting "Too large resource version" error before 1.17.0 #115093

Merged

Conversation

xuzhenglun
Copy link
Contributor

@xuzhenglun xuzhenglun commented Jan 16, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

since #72170 is reverted in 1.16.x, and the code in the release-1.16 did not return details.cause field (see ref code). so isTooLargeResourceVersionError in reflector should fail to detect this error come from kube-apiserver before 1.17.0, and can not recovery as expected.

I know the version of client-go should align with kube-apiserver as far as we can, and the version skew policy is presented. but in some cases, for example some third party software, is hard to ensure that. so maybe being more comparable is good?

Which issue(s) this PR fixes:

Fixes #94315
Fixed #91073
Fixed #94316

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fixed bug in reflector that couldn't recover from "Too large resource version" errors with API servers before 1.17.0

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

NONE

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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. 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 Jan 16, 2023
@xuzhenglun xuzhenglun force-pushed the too-large-resource-version-1.16 branch from 97c4afa to 065285a Compare January 16, 2023 05:22
@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 Jan 16, 2023
@xuzhenglun xuzhenglun force-pushed the too-large-resource-version-1.16 branch 2 times, most recently from e976938 to f630791 Compare January 16, 2023 05:25
@xuzhenglun xuzhenglun force-pushed the too-large-resource-version-1.16 branch from f630791 to 11e5e92 Compare January 16, 2023 05:45
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 16, 2023
@aojea
Copy link
Member

aojea commented Jan 16, 2023

I'm not very thrilled for adding code to support "unsupported" versions, is not just the skewed versions, is that last supported version is 1.22

/assign @liggitt

@pacoxu
Copy link
Member

pacoxu commented Jan 16, 2023

Can we accept such fixes if there is no side-effect for supported versions? (This of course is out of the supported versions scope, but client-go is widely used.) If there is any side effect, we must decline the pr.

  • Add my use case of multi-clusters management that may benefit if this is fixed, we support importing Kubernetes 1.10+ as users may have some old clusters that will not be upgraded for some reason(have to run with docker/negative deploying policies: new applications will be deployed into new clusters and just keep old applications running on old servers).

@xuzhenglun
Copy link
Contributor Author

here is my use case:

  • We have some products that don't actually depend on a specific version of Kubernetes, so they are supposed to support a wide range of versions. When they sell to customers, the version of the customer's in-used cluster can be very old. But it is actually unfair to ask the product teams to lower the client-go version for this reason because the newer client-go have tonnes of bugfix/new features.

Considering 1.17 is so old, It's fair if this is declined. But it's really nice if this could be fixed because client-go is so wildly used, and I will really appreciate it.

@liggitt
Copy link
Member

liggitt commented Jan 17, 2023

I agree that it is useful for the generic aspects of client-go to work well against as many versions as possible, this doesn't seem burdensome to maintain, and the function it is in is already checking conditions which are only true for already-out-of-support servers.

/assign @wojtek-t
for detailed review of pre-1.17 behavior

@cici37
Copy link
Contributor

cici37 commented Jan 17, 2023

/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 Jan 17, 2023
@wojtek-t
Copy link
Member

I agree that it is useful for the generic aspects of client-go to work well against as many versions as possible, this doesn't seem burdensome to maintain, and the function it is in is already checking conditions which are only true for already-out-of-support servers.

+1
And additionally this code is well separated and easy to follow so that seems fine.

The addition also looks correct:
https://github.com/kubernetes/kubernetes/blob/release-1.16/staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go#L307

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 18, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3e1cbb21100e706efeb070dcfcbf3270bceb689a

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jan 18, 2023
@k8s-ci-robot k8s-ci-robot merged commit d3f881f into kubernetes:master Jan 18, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.27 milestone Jan 18, 2023
@aojea
Copy link
Member

aojea commented Jan 18, 2023

I stand corrected 😄

@xuzhenglun xuzhenglun deleted the too-large-resource-version-1.16 branch January 18, 2023 13:00
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/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 Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
7 participants