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 DeleteCollection API decode DeleteOptions fail #113133

Merged
merged 1 commit into from Oct 20, 2022

Conversation

sxllwx
Copy link
Member

@sxllwx sxllwx commented Oct 18, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

DeleteCollection API decode DeleteOptions fail.

The reason for the issue is that the apiserver uses the Scheme in the global variable pkg/api/legacyscheme/scheme.go, and registers the DeleteOptions corresponding to each APIGroup in the Scheme. But DeleteOptions in meta.k8s.io/v1 is not registered, resulting in a notRegisteredErr.

Which issue(s) this PR fixes:

Fixes # #111985

Special notes for your reviewer:

Maybe we need to cherry-pick to the most recent release.

Does this PR introduce a user-facing change?

kube-apiserver: DELETECOLLECTION API requests are now recorded in metrics with the correct verb.

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


@k8s-ci-robot
Copy link
Contributor

@sxllwx: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 18, 2022
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. 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 Oct 18, 2022
@Jefftree
Copy link
Member

/retest

@Jefftree
Copy link
Member

Thanks!
/assign @lavalamp

@@ -214,13 +215,14 @@ func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope *RequestSc

options := &metav1.DeleteOptions{}
if checkBody {
body, err := limitedReadBody(req, scope.MaxRequestBodyBytes)
body, err := limitedReadBodyWithRecordMetric(ctx, req, scope.MaxRequestBodyBytes, scope.Resource.GroupResource().String(), requestmetrics.Delete)
Copy link
Member

Choose a reason for hiding this comment

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

DELETECOLLECTION is its own verb and probably should not use requestmetrics.Delete here

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in latest commit, PTAL~

@lavalamp
Copy link
Member

@apelisse the test failure here appears to be in SSA integration tests, is that flaky? I wouldn't expect this code change to break that.

@apelisse
Copy link
Member

There seems to be a little bit of flakiness around these tests, we should definitely take a look:
https://testgrid.k8s.io/presubmits-kubernetes-blocking#pull-kubernetes-integration

@lavalamp
Copy link
Member

the test logs sound like it's trying to apply something to widgets before widgets have been created...

@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 Oct 18, 2022
The reason for the issue is that the apiserver uses the Scheme in the
global variable pkg/api/legacyscheme/scheme.go, and registers the
DeleteOptions corresponding to each APIGroup in the Scheme.  But
DeleteOptions in meta.k8s.io/v1 is not registered, resulting
in a notRegisteredErr.

Use metainternalversionscheme.Codecs as Serializer
@apelisse
Copy link
Member

I've posted my understanding of the flake somewhere else, and we probably should have the discussion there, it's totally unrelated to this PR.

@sxllwx
Copy link
Member Author

sxllwx commented Oct 20, 2022

@lavalamp @Jefftree What do we need to do to move this thing forward?

@sxllwx
Copy link
Member Author

sxllwx commented Oct 20, 2022

/ping @lavalamp PTAL, thx

Copy link
Member

@logicalhan logicalhan left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 20, 2022
@lavalamp
Copy link
Member

(I edited a release note into the OP to avoid having to do another review round, double check to see if you agree with it)

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lavalamp, sxllwx

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 Oct 20, 2022
@Jefftree
Copy link
Member

The do not merge release note tag seems to still be there.
Let's see if we can trigger the bot again

/release-note-edit kube-apiserver: DELETECOLLECTION API requests are now recorded in metrics with the correct verb.

@Jefftree
Copy link
Member

@lavalamp You might need to manually remove the "do-not-merge/release-note-label-needed" label as well.

@lavalamp
Copy link
Member

/release-note-edit kube-apiserver: DELETECOLLECTION API requests are now recorded in metrics with the correct verb (formerly were counted as calls to update).

@lavalamp lavalamp removed the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Oct 20, 2022
@lavalamp
Copy link
Member

Manually removed since it seems correct AFAICT and the bot doesn't like my commands

@k8s-ci-robot k8s-ci-robot merged commit 615929e into kubernetes:master Oct 20, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Oct 20, 2022
sxllwx added a commit to sxllwx/kubernetes that referenced this pull request Oct 24, 2022
…k-of-kubernetes#113133-upstream-release-1.25

Automated cherry pick of kubernetes#113133: Fix DeleteCollection API decode DeleteOptions fail
k8s-ci-robot added a commit that referenced this pull request Oct 31, 2022
…33-upstream-release-1.25

Automated cherry pick of #113133: Fix DeleteCollection API decode DeleteOptions fail
sxllwx added a commit to sxllwx/kubernetes that referenced this pull request Nov 17, 2022
…k-of-kubernetes#113133-upstream-release-1.25

Automated cherry pick of kubernetes#113133: Fix DeleteCollection API decode DeleteOptions fail
sxllwx added a commit to sxllwx/kubernetes that referenced this pull request Nov 17, 2022
…k-of-kubernetes#113133-upstream-release-1.25

Automated cherry pick of kubernetes#113133: Fix DeleteCollection API decode DeleteOptions fail
k8s-ci-robot added a commit that referenced this pull request Jan 13, 2023
…86-upstream-release-1.23

Automated cherry pick of #113286: Merge pull request #113133 from
k8s-ci-robot added a commit that referenced this pull request Jan 13, 2023
…86-upstream-release-1.24

Automated cherry pick of #113286: Merge pull request #113133 from
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. 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

7 participants