Skip to content
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

webhook: Basic validation for multiple HTTPRoute Rule filters #506

Closed

Conversation

cmluciano
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:

  • This is a skeleton admission webhook to validate duplicate HTTPRoute Rule.Filters

Which issue(s) this PR fixes:
Fixes #349

Notes For Reviewers

  • This PR still needs some further deploy config for actually setting up and using the webhook. I mainly wanted to add it early so we can validate if the logic looks sane.

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 16, 2020
@cmluciano
Copy link
Contributor Author

/cc @hbagdi @robscott

@cmluciano cmluciano force-pushed the cml/reqmirrorwebhook branch from 3237166 to f3d9228 Compare December 17, 2020 16:38
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 17, 2020
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this! Excited to see all the progress on this front!

pkg/admission/validator.go Outdated Show resolved Hide resolved
pkg/admission/validator_test.go Outdated Show resolved Hide resolved
pkg/admission/server.go Outdated Show resolved Hide resolved
pkg/admission/server.go Outdated Show resolved Hide resolved
pkg/admission/server.go Outdated Show resolved Hide resolved
pkg/admission/server.go Outdated Show resolved Hide resolved
@cmluciano cmluciano force-pushed the cml/reqmirrorwebhook branch from f3d9228 to d8aed04 Compare December 18, 2020 17:37
Copy link
Contributor

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

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

This is a good starting point!

pkg/admission/validator.go Outdated Show resolved Hide resolved
pkg/admission/server.go Show resolved Hide resolved
pkg/admission/server.go Outdated Show resolved Hide resolved
pkg/admission/server.go Show resolved Hide resolved
pkg/admission/server.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 8, 2021
@cmluciano cmluciano marked this pull request as ready for review January 8, 2021 19:50
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 8, 2021
@cmluciano
Copy link
Contributor Author

This is now ready for review @robscott @hbagdi

If you deploy the service-api crds and then ./deploy/webhook.yaml, it will configure the webhook. I also have two examples that you can test located under the deploy folder.

@cmluciano cmluciano force-pushed the cml/reqmirrorwebhook branch 2 times, most recently from 21c1758 to 7d72900 Compare January 8, 2021 21:51
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks for all your work on this! Still need to test this out myself but it's looking really promising.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
cmd/controller/main.go Outdated Show resolved Hide resolved
deploy/webhook.yaml Outdated Show resolved Hide resolved
deploy/single_filter.yaml Outdated Show resolved Hide resolved
deploy/webhook.yaml Outdated Show resolved Hide resolved
deploy/webhook.yaml Outdated Show resolved Hide resolved
deploy/webhook.yaml Outdated Show resolved Hide resolved
pkg/admission/validator_test.go Outdated Show resolved Hide resolved
pkg/admission/validator_test.go Outdated Show resolved Hide resolved
@cmluciano cmluciano force-pushed the cml/reqmirrorwebhook branch from 7d72900 to d2189f6 Compare January 11, 2021 20:08
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 11, 2021
@cmluciano cmluciano requested a review from robscott February 1, 2021 18:19
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks for the work on this! I spun this up on a kind 1.20 cluster and the installation seemed to work until the webhook pod ran into a logging issue. Maybe we can build some form of basic e2e tests into this where it will spin up a kind cluster and apply the deploy yaml, the crd yaml, and some examples to make sure it all works well together.

.gitignore Outdated Show resolved Hide resolved
deploy/admission_webhook.yaml Outdated Show resolved Hide resolved
spec:
containers:
- name: webhook
image: cmluciano/service-apis-admission:latest
Copy link
Member

Choose a reason for hiding this comment

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

I think you're already working on this, but just in case, here's a reminder to change the image used here.

@hbagdi
Copy link
Contributor

hbagdi commented Feb 4, 2021

@cmluciano This PR has had so many comments that it is hard to keep track of. There are a few issues from the early PR review that need fixing. Could you take a look at those?

@cmluciano cmluciano force-pushed the cml/reqmirrorwebhook branch from fca95ef to 3c1df19 Compare March 25, 2021 20:08
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cmluciano
To complete the pull request process, please assign jpeach after the PR has been reviewed.
You can assign the PR to them by writing /assign @jpeach in a comment when ready.

The full list of commands accepted by this bot can be found 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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 25, 2021
@cmluciano cmluciano force-pushed the cml/reqmirrorwebhook branch from 3c1df19 to f6c91f2 Compare March 25, 2021 20:10
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 25, 2021
Signed-off-by: Christopher M. Luciano <cmluciano@isovalent.com>
@cmluciano cmluciano force-pushed the cml/reqmirrorwebhook branch from f6c91f2 to a693f03 Compare March 25, 2021 20:31
@k8s-ci-robot
Copy link
Contributor

@cmluciano: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-gateway-api-test a693f03 link /test pull-gateway-api-test
pull-gateway-api-verify a693f03 link /test pull-gateway-api-verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@robscott
Copy link
Member

Thanks for the work to update this @cmluciano! This feels like it's quite close, it just got tripped up by some of our API changes that made optional fields pointers.

@danehans
Copy link
Contributor

Note that #597 intends to add a validation package that should be consumed by the webhook implementation.

@danehans
Copy link
Contributor

danehans commented Apr 9, 2021

@cmluciano PTAL at #597 that added a validation pkg. I have a branch that provides an example implementation for the admission controller. It would be great if this PR was updated, i.e. ValidateHTTPRoute(), to use the validation pkg. Ping me when this PR merges and I’ll submit a PR to add Gateway hostname validation to the admission controller. Does this make sense to you? cc: @robscott @bowei

@hbagdi
Copy link
Contributor

hbagdi commented Apr 12, 2021

I talked to @cmluciano today. I'll try to get this over the finish line this week.

hbagdi added a commit to hbagdi/service-apis that referenced this pull request Apr 13, 2021
A variation of this patch first appeared in kubernetes-sigs#506.
This patch is derived from kubernetes-sigs#506 and has been reworked to include it in
the validation package.
@hbagdi
Copy link
Contributor

hbagdi commented Apr 13, 2021

I'm reworking parts of this PR and breaking it up to get this over the finish line.
#606 is first of one such patch.
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 13, 2021
hbagdi added a commit to hbagdi/service-apis that referenced this pull request Apr 13, 2021
A variation of this patch first appeared in kubernetes-sigs#506.
This patch is derived from kubernetes-sigs#506 and has been reworked to include it in
the validation package.

Co-authored-by: Christopher M. Luciano <cmluciano@us.ibm.com>
hbagdi added a commit to hbagdi/service-apis that referenced this pull request Apr 13, 2021
A variation of this patch first appeared in kubernetes-sigs#506.
This patch is derived from kubernetes-sigs#506 and has been reworked to include it in
the validation package.

Co-authored-by: Christopher M. Luciano <cmluciano@us.ibm.com>
@k8s-ci-robot
Copy link
Contributor

@cmluciano: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2021
hbagdi added a commit to hbagdi/service-apis that referenced this pull request Apr 13, 2021
A variation of this patch first appeared in kubernetes-sigs#506.
This patch is derived from kubernetes-sigs#506 and has been reworked to include it in
the validation package.

Co-authored-by: Christopher M. Luciano <cmluciano@isovalent.com>
hbagdi added a commit to hbagdi/service-apis that referenced this pull request Apr 14, 2021
A variation of this patch first appeared in kubernetes-sigs#506.
This patch is derived from kubernetes-sigs#506 and has been reworked to include it in
the validation package.

Co-authored-by: Christopher M. Luciano <cmluciano@isovalent.com>
hbagdi added a commit to hbagdi/service-apis that referenced this pull request Apr 16, 2021
A variation of this patch first appeared in kubernetes-sigs#506.
This patch is derived from kubernetes-sigs#506 and has been reworked to include it in
the validation package.

Co-authored-by: Christopher M. Luciano <cmluciano@isovalent.com>
@hbagdi
Copy link
Contributor

hbagdi commented Apr 20, 2021

Superseded by #617

@hbagdi hbagdi closed this Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTPRequestMirrorFilter needs webhook validation
6 participants