Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

chore: webhook functions now return AdmissionResponse #1282

Merged

Conversation

makkes
Copy link
Contributor

@makkes makkes commented Sep 22, 2020

What this PR does / why we need it:

Having these functions modify the AdmissionResponse passed in as
parameter makes it hard to reason about the code.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1267

Special notes for your reviewer:

@k8s-ci-robot k8s-ci-robot 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. labels Sep 22, 2020
@makkes
Copy link
Contributor Author

makkes commented Sep 23, 2020

I'll have to have a look at the failing tests as well.

@makkes
Copy link
Contributor Author

makkes commented Sep 24, 2020

Ok, failing test was just caused by the linter.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 25, 2020
@RainbowMango
Copy link
Contributor

I guess commit should be squashed, otherwise, LGTM.

Having these functions modify the AdmissionResponse passed in as
parameter makes it hard to reason about the code.

controller.webhook.util.Unmarshal was removed for the sake of not
having to return nil in case of success. This adds a bit more code to
the calling functions but at the same time helps bring across the
intended behaviour.
@makkes
Copy link
Contributor Author

makkes commented Sep 28, 2020

commits are squashed now.

@RainbowMango
Copy link
Contributor

/lgtm
Thanks.

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 28, 2020
@jimmidyson
Copy link
Contributor

/approve

Thanks @makkes!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jimmidyson, makkes

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 Sep 28, 2020
@k8s-ci-robot k8s-ci-robot merged commit b31dd08 into kubernetes-retired:master Sep 28, 2020
@makkes makkes deleted the return-admissionresponse branch September 28, 2020 09:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. lgtm 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.

pkg/controller/webhook.Validate et al should return an AdmissionResponse
4 participants