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

Remove validating webhook #2595

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Conversation

robscott
Copy link
Member

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
As described in #2319, it's time for the webhook to go away. The next minor release of Gateway API will not include the webhook, so there's no need to keep it around. This should also dramatically speed up presubmits.

Does this PR introduce a user-facing change?:

The validating webhook has been removed. CEL validation is now built-in to CRDs and replaces the webhook.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 17, 2023
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 17, 2023
@robscott
Copy link
Member Author

This is a pretty big PR, will add a hold so we can get at least a couple reviewers to sign off on this.

/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 Nov 17, 2023
@@ -56,8 +56,8 @@ type GatewayList struct {
// GatewaySpec defines the desired state of Gateway.
//
// Not all possible combinations of options specified in the Spec are
// valid. Some invalid configurations can be caught synchronously via a
// webhook, but there are many cases that will require asynchronous
// valid. Some invalid configurations can be caught synchronously via CRD
Copy link
Member

Choose a reason for hiding this comment

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

not CEL validation ? I feel like CRD validation is vague and can be done in various different ways and not necessarily CEL

Copy link
Member

Choose a reason for hiding this comment

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

ditto for other mentions of CRD validation

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, you're right, this is intentionally vague. CRD validation is intended to cover all forms of built-in validation, including both CEL and OpenAPI, I don't think we need to provide that level of detail in the spec though as the implementation details of the validation could change without meaningfully changing the spec.

Copy link
Member

@Xunzhuo Xunzhuo left a comment

Choose a reason for hiding this comment

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

Generally LGTM, thanks for working on it Rob, since it is a big PR, defer to other forks to have a look, in case we do not miss anything.

Copy link
Member

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

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

We still have a section in guidelines.md entitled Limitations of CRD and Webhook Validation which we may want to reword some, as it seems the relevance will be somewhat changed and broken after this PR.

Also found a couple other documentation areas, you can probably just apply this diff to resolve them:

diff --git a/site-src/concepts/versioning.md b/site-src/concepts/versioning.md
index 4a254122..d9e11f48 100644
--- a/site-src/concepts/versioning.md
+++ b/site-src/concepts/versioning.md
@@ -2,12 +2,11 @@
 
 ## Overview
 Each new release of Gateway API is defined with a "bundle version" that
-represents the Git tag of a release, such as v0.8.0. This contains the
+represents the Git tag of a release, such as v1.0.0. This contains the
 following:
 
 * API Types (Go bindings for the resources)
 * CRDs (Kubernetes definitions of the resources)
-* Validating Webhook (Will be deprecated in v1.0 release)
 
 ### Release Channels
 Release channels are used to indicate feature stability within Gateway API. All
diff --git a/site-src/contributing/contributor-ladder.md b/site-src/contributing/contributor-ladder.md
index d498de5b..760fb7f7 100644
--- a/site-src/contributing/contributor-ladder.md
+++ b/site-src/contributing/contributor-ladder.md
@@ -85,7 +85,6 @@ reviewer or approver, this includes:
 * Conformance
 * Documentation
 * GEPs
-* Webhook Validation
 
 ## Maintainers and GAMMA Leads
 

If not part of THIS pr, then definitely of one in the future as we cut the release that removes the webhook.

@robscott
Copy link
Member Author

robscott commented Dec 5, 2023

Thanks @shaneutt! I applied your suggestions + added the following note on the guidelines.md file:

    Webhook validation in Gateway API has been deprecated and will be fully
    removed in v1.1.0. With that said, all of this guidance will still apply for
    implementations as long as they support v1.0.0 or older releases of the API.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, for all the files in /validation, are breaking an API by removing this validation code? Is this code used directly by implementations, rather than just in the webhook? Should we do a separate deprecation for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. In my opinion, this is covered under "source code" within our versioning policy which has no compatibility guarantees: https://gateway-api.sigs.k8s.io/concepts/versioning/#source-code. I started to split this out to leave validation code in and just deprecate the packages, but I think that could lead to a worse outcome - stale code. Although we have some unit tests for the code, by removing the webhook, we'd be removing one of the primary ways we tested this code. I think the removal of this is adequately covered by the overall webhook deprecation announcements we made in the v0.8 and v1.0 release notes.

Comment on lines -122 to -124
###
# This section and below can be REMOVED once the webhook is removed.
###
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

@youngnick
Copy link
Contributor

LGTM with one caveat about if we can remove the validation packages yet.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: robscott, shaneutt

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 7, 2023
@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 8, 2023
@youngnick
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 13, 2023
@robscott
Copy link
Member Author

I think this has sat long enough, been discussed at multiple community meetings, and now has multiple approvals, removing the hold.

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 13, 2023
@k8s-ci-robot k8s-ci-robot merged commit 052e0d1 into kubernetes-sigs:main Dec 13, 2023
8 checks passed
@shaneutt shaneutt deleted the remove-webhook branch December 13, 2023 05:11
@jwendell
Copy link
Contributor

Should the validation go package be removed only from v1 and not from v1alpha1 and v1beta1?

Asking because Istio imports sigs.k8s.io/gateway-api/apis/v1alpha2/validation to perform some validation, and now they are gone. How can we support both 1.0 and older?

@howardjohn
Copy link
Contributor

Should the validation go package be removed only from v1 and not from v1alpha1 and v1beta1?

Asking because Istio imports sigs.k8s.io/gateway-api/apis/v1alpha2/validation to perform some validation, and now they are gone. How can we support both 1.0 and older?

Istio doesn't support v1alpha2 anymore. I think the current logic is broken in Istio, and can probably be removed entirely given the removal of the webhook?

@robscott
Copy link
Member Author

Since CEL has been present in CRDs since v0.8 and this validation code will only be removed as part of the v1.1 release (when this PR will get released), I think it's likely safe to remove any code that ran these validations controller-side when you upgrade to importing v1.1. Note that the v1.1 release is still likely at least a couple of months away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

8 participants