-
Notifications
You must be signed in to change notification settings - Fork 585
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
Add validating admission webhook #129
Add validating admission webhook #129
Conversation
* Add validating admission webhook HTTP server application * Handle incoming AdmissionReview requests and validate their correctness, handle errors if any * Validate Network Attachment Definition objects * Send AdmissionReview response with allowed/denied decision and its reason * In case of any other errors (malformed HTTP request, empty body, etc.) send proper HTTP error code * Use TLS encryption * Add some basic unit tests for Network Attachment Definition objects validation * Build Docker image with webhook application Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
* Add script for automated certtificates and secret generation * Add pod, service and webhook configuration specification files Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
Pull Request Test Coverage Report for Build 421
💛 - Coveralls |
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.
Thank a lot @przemek-lal . I will test it :)
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.
Deployment comments: likely to flexible with all env
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.
Added comments
webhook/build
Outdated
@@ -0,0 +1 @@ | |||
docker build -t multus-webhook . |
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.
Include the proxy build args here
docker build --build-arg http_proxy=$(http_proxy) \
--build-arg HTTP_PROXY=$(HTTP_PROXY) \
--build-arg https_proxy=$(https_proxy) \
--build-arg HTTPS_PROXY=$(HTTPS_PROXY) \
--build-arg no_proxy=$(no_proxy) \
--build-arg NO_PROXY=$(NO_PROXY) \
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.
change it something like this
#!/usr/bin/env bash
set -e
docker build --build-arg http_proxy=${http_proxy} \
--build-arg HTTP_PROXY=${HTTP_PROXY} \
--build-arg https_proxy=${https_proxy} \
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
--build-arg no_proxy=${no_proxy} \
--build-arg NO_PROXY=${NO_PROXY} -t multus-webhook .
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.
Please change the build script to fit all the deployment env
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.
Include proxy env
webhook/build
Outdated
@@ -0,0 +1 @@ | |||
docker build -t multus-webhook . |
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.
change it something like this
#!/usr/bin/env bash
set -e
docker build --build-arg http_proxy=${http_proxy} \
--build-arg HTTP_PROXY=${HTTP_PROXY} \
--build-arg https_proxy=${https_proxy} \
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
--build-arg no_proxy=${no_proxy} \
--build-arg NO_PROXY=${NO_PROXY} -t multus-webhook .
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
okay, proxy env variables added |
Regarding the I am getting the following error:
|
Error message says it all: As stated in the Manage TLS Certificates in a Cluster guide, in order to sign certificate with Kubernetes CA you need to pass the |
deployment/webhook/pod.yaml
Outdated
# limitations under the License. | ||
|
||
apiVersion: v1 | ||
kind: Pod |
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 a Deployment instead of a Pod. I'll update the PR.
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
@przemek-lal Thanks . I will check these option in my controller. Could you please update the readme file on this. I believe most of the developers, are not aware of these items. |
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
Okay, I made a couple of updates:
|
In my set-up, I am getting only this log, and multus webhook is allowing the invalid net-attach-def
Will sync up to get the more details. |
Looking into a fix for this, but, a few things... Firstly, If I run the
Secondarily, I'm wondering if there's a way we can do this without the installation requiring a shell script to be run before we start this up. Looking for a way to automate this process and reduce the steps to have this installed, maybe through a daemonset / init containers / etc. |
Hey Doug, I think that the TLS bootstrapping could be done in a Job. It would create a private key, sign it with K8s CA, then create a secret and validating admission controller configuration. So there would be literally zero input from the user required apart from creating the job by running kubectl command. Would this make sense? In this case no bash scripts would be needed, so no problems with the permissions you had. |
Hey guys, I just opened a new PR #186 which contains slightly updated validating webhook code and completely changes deployment procedure. It also adds feature for mutating pods basing on the network objects annotations presence, more details in that PR. |
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.
Guys, it's time! OK to merge this up, sorry if the delay was on my end.
Add validating admission webhook:
Add deployment files for validating admission webhook:
Add documentation for validating admission webhook.
Fixes #119.
Signed-off-by: Przemyslaw Lal przemyslawx.lal@intel.com