-
Notifications
You must be signed in to change notification settings - Fork 490
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
implement an admission webhook server #617
implement an admission webhook server #617
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hbagdi 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 |
The scope of this PR is to get this merged into mainline and then work on documentation, otherwise the scope of this work keeps on increasing and it gets very hard to actually land in the mainline. I had to invest significant amount of time reworking major area over #506 to get this working again. How can a reviewer test this out? Bad HTTPRoute: https://gist.github.com/hbagdi/b7d7cfde79610133846edf2644530e6c, create a local file out of the gist.
|
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 very cool, thanks for all the work on this @hbagdi and @cmluciano! Excited to see this getting so close.
Tested this out in a new cluster and it worked flawlessly, nicely done! |
a95b218
to
1104444
Compare
@cmluciano @robscott I simplified the code to make the behavior across Create and Update operation exactly same. I don't think we have a case (yet) that requires validation to be different for update and create. Does that feel right? @bowei @danehans Since this is an initial PR for some code that is going to grow in future, can you also review this? |
1104444
to
8dab9ef
Compare
LGTM, adding a hold until we can get an official image published. /hold |
8dab9ef
to
75129ff
Compare
@robscott I removed the docker image reference to I'm open to adding more here if necessary. |
/cc @danehans |
deploy/admission_webhook.yaml
Outdated
spec: | ||
containers: | ||
- name: webhook | ||
# TODO(hbagdi): Swap image name to the k8s official image |
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.
pkg/admission/server.go
Outdated
} | ||
|
||
func handleValidation(request admission.AdmissionRequest) ( | ||
*admission.AdmissionResponse, error) { |
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.
Why a new line for the returned types?
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.
One comment about testing v1beta1 submissions but otherwise lgtm. Thank you for carrying this forward :D
pkg/admission/server_test.go
Outdated
|
||
func TestServeHTTPSubmissions(t *testing.T) { | ||
for _, apiVersion := range []string{ | ||
"admission.k8s.io/v1beta1", |
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.
Do we still need to accept this if we use only setup webhook v1 validation
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.
Updated to v1 only.
Co-authored-by: Christopher M. Luciano <cmluciano@isovalent.com>
75129ff
to
c3807e6
Compare
/lgtm |
Co-authored-by: Christopher M. Luciano cmluciano@isovalent.com
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR introduces a new admission webhook server that will be used for advanced validation functionality.
Which issue(s) this PR fixes:
Fixes #349
Does this PR introduce a user-facing change?: