-
Notifications
You must be signed in to change notification settings - Fork 332
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
Split the resource semantic webhooks into separate AdmissionControllers #848
Conversation
This also removes the long-deprecated |
ctx = apis.WithUserInfo(ctx, &req.UserInfo) | ||
|
||
// None of the validators will accept a nil value for newObj. | ||
if newObj == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved quite a lot up. No reason to deal with deserialization of the oldObj
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is largely copy/pasta, so I'd rather leave it for a follow-up cleanup pass.
3f9bcd4
to
21993fe
Compare
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, vaikas 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 |
hold can be removed ? |
21993fe
to
f4b7677
Compare
4e5f033
to
492ed28
Compare
492ed28
to
47c8758
Compare
By combining our validation logic into our mutating webhook we were previously allowing for mutating webhooks evaluated after our own to modify our resources into invalid shapes. There are no guarantees around ordering of mutating webhooks (that I could find), so the only way to remedy this properly is to split apart the two into separate webhook configurations: - `defaulting`: which runs during the mutating admission webhook phase - `validation`: which runs during the validating admission webhook phase. The diagram in [this post](https://kubernetes.io/blog/2019/03/21/a-guide-to-kubernetes-admission-controllers/) is very helpful in illustrating the flow of webhooks. Fixes: knative#847
47c8758
to
dcfbe32
Compare
The following is the coverage report on the affected files.
|
/lgtm This is gonna fix some weird bugs. |
/hold cancel |
`NewAdmissionController` was moved to `resourcesemantics/validation` in knative#848 and this doc wasn't updated.
`NewAdmissionController` was moved to `resourcesemantics/validation` in #848 and this doc wasn't updated.
By combining our validation logic into our mutating webhook we were previously allowing for mutating webhooks evaluated after our own to modify our resources into invalid shapes. There are no guarantees around ordering of mutating webhooks (that I could find), so the only way to remedy this properly is to split apart the two into separate webhook configurations:
defaulting
: which runs during the mutating admission webhook phasevalidation
: which runs during the validating admission webhook phase.The diagram in this post is very helpful in illustrating the flow of webhooks.
Fixes: #847
/hold
I need to stage downstream PRs for this.