Skip to content

🐛 pkg/webhook/admission: set GVK on AdmissionReview responses #1293

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

Conversation

estroz
Copy link
Contributor

@estroz estroz commented Dec 9, 2020

Specifying multiple admissionReviewVersions in a webhook config with v1 as the first version causes untyped (no GVK) AdmissionReview responses to fail with an error like

failed calling webhook "mfoo.kb.io": expected webhook response of admission.k8s.io/v1, Kind=AdmissionReview, got /, Kind=

This error results from the API server checking response type for v1 but not v1beta1. By setting the AdmissionReview object's GVK to the request's type if it exists or defaulting to v1, the webhook handler can patch over this problem.

/kind bug

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 9, 2020
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 9, 2020
@estroz
Copy link
Contributor Author

estroz commented Dec 9, 2020

/cc @vincepri

@k8s-ci-robot k8s-ci-robot requested a review from vincepri December 9, 2020 03:54
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @alvaroaleman

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 10, 2020
@vincepri
Copy link
Member

/milestone v0.7.x

@k8s-ci-robot k8s-ci-robot added this to the v0.7.x milestone Dec 10, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: estroz, vincepri

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 Dec 10, 2020
@k8s-ci-robot k8s-ci-robot merged commit f7a3dc6 into kubernetes-sigs:master Dec 10, 2020
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants